tests: remove json tests
There's no point in testing it.
This commit is contained in:
parent
0053bec0b1
commit
4fd5dcf29a
1 changed files with 0 additions and 62 deletions
62
test.lua
62
test.lua
|
@ -158,64 +158,6 @@ fs.dirname("]] .. dpath .. '")'
|
|||
end
|
||||
},
|
||||
|
||||
-- basic tests for lua-cjson; this is not
|
||||
-- my library so I won't test it extensively
|
||||
json = {
|
||||
decode = function()
|
||||
local o = [[
|
||||
"hello": "world",
|
||||
"n": 4,
|
||||
"fpn": 2.4444449,
|
||||
"a": [1, 2, 4, 8, 16]
|
||||
]]
|
||||
local j = [[
|
||||
{
|
||||
]] .. o .. [[,
|
||||
"o": {
|
||||
]] .. o .. [[
|
||||
}
|
||||
}
|
||||
]]
|
||||
|
||||
local t = json.decode(j)
|
||||
|
||||
for _, t in ipairs {t, t.o} do
|
||||
assert(t.hello == "world")
|
||||
assert(t.n == 4)
|
||||
assert(t.fpn == 2.4444449)
|
||||
assert(t.a[1] == 1)
|
||||
assert(t.a[2] == 2)
|
||||
assert(t.a[3] == 4)
|
||||
assert(t.a[4] == 8)
|
||||
assert(t.a[5] == 16)
|
||||
end
|
||||
|
||||
return "json.decode('" .. j:gsub("%s", "") .. "')"
|
||||
end,
|
||||
encode = function()
|
||||
local o = {
|
||||
hello = "world",
|
||||
n = 4,
|
||||
fpn = 2.4444449,
|
||||
a = {1, 2, 4, 8, 16}
|
||||
}
|
||||
|
||||
local j = json.encode(o)
|
||||
local t = json.decode(j)
|
||||
|
||||
assert(t.hello == "world")
|
||||
assert(t.n == 4)
|
||||
assert(t.fpn == 2.4444449)
|
||||
assert(t.a[1] == 1)
|
||||
assert(t.a[2] == 2)
|
||||
assert(t.a[3] == 4)
|
||||
assert(t.a[4] == 8)
|
||||
assert(t.a[5] == 16)
|
||||
|
||||
return "json.decode(json.encode({...}))"
|
||||
end
|
||||
},
|
||||
|
||||
os = {
|
||||
hostname = function ()
|
||||
assert(os.hostname())
|
||||
|
@ -272,10 +214,6 @@ do
|
|||
test(fs.remove)
|
||||
test(fs.workdir)
|
||||
|
||||
-- json
|
||||
test(json.decode)
|
||||
test(json.encode)
|
||||
|
||||
-- os
|
||||
test(os.hostname)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue