mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-27 01:13:00 +00:00
tests/weaschem: more tests, but not done w/parse_header yet
This commit is contained in:
parent
270ec92fee
commit
8d79e6f0ab
4 changed files with 62 additions and 0 deletions
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "A castle",
|
||||||
|
"description": 88,
|
||||||
|
"size": {
|
||||||
|
"x": 50,
|
||||||
|
"y": 25,
|
||||||
|
"z": 75
|
||||||
|
},
|
||||||
|
"offset": {
|
||||||
|
"x": 3,
|
||||||
|
"y": 0,
|
||||||
|
"z": 5
|
||||||
|
},
|
||||||
|
"type": "full",
|
||||||
|
"generator": "WorldEditAdditions v1.14"
|
||||||
|
}
|
10
.tests/parse/file/testfiles/header_invalid_no_offset.json
Normal file
10
.tests/parse/file/testfiles/header_invalid_no_offset.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "A castle",
|
||||||
|
"size": {
|
||||||
|
"x": 50,
|
||||||
|
"y": 25,
|
||||||
|
"z": 75
|
||||||
|
},
|
||||||
|
"type": "full",
|
||||||
|
"generator": "WorldEditAdditions v1.14"
|
||||||
|
}
|
10
.tests/parse/file/testfiles/header_invalid_no_size.json
Normal file
10
.tests/parse/file/testfiles/header_invalid_no_size.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "A castle",
|
||||||
|
"offset": {
|
||||||
|
"x": 50,
|
||||||
|
"y": 25,
|
||||||
|
"z": 75
|
||||||
|
},
|
||||||
|
"type": "full",
|
||||||
|
"generator": "WorldEditAdditions v1.14"
|
||||||
|
}
|
|
@ -63,5 +63,31 @@ describe("parse.file.weaschem.parse_header", function()
|
||||||
assert.are.same("HEADER_NAME_INVALID", code)
|
assert.are.same("HEADER_NAME_INVALID", code)
|
||||||
assert.are.same("string", type(result))
|
assert.are.same("string", type(result))
|
||||||
end)
|
end)
|
||||||
|
it("should complain for an invalid header with description of wrong type", function()
|
||||||
|
local content = get_json_string("invalid_description_type")
|
||||||
|
assert.are_not.same(nil, content)
|
||||||
|
local success, code, result = weaschem.parse_header(content)
|
||||||
|
assert.are.same(false, success)
|
||||||
|
assert.are.same("HEADER_DESCRIPTION_INVALID", code)
|
||||||
|
assert.are.same("string", type(result))
|
||||||
|
end)
|
||||||
|
it("should complain for an invalid header with no offset", function()
|
||||||
|
local content = get_json_string("invalid_no_offset")
|
||||||
|
assert.are_not.same(nil, content)
|
||||||
|
local success, code, result = weaschem.parse_header(content)
|
||||||
|
assert.are.same(false, success)
|
||||||
|
assert.are.same("HEADER_NO_OFFSET", code)
|
||||||
|
assert.are.same("string", type(result))
|
||||||
|
end)
|
||||||
|
it("should complain for an invalid header with no size", function()
|
||||||
|
local content = get_json_string("invalid_no_size")
|
||||||
|
assert.are_not.same(nil, content)
|
||||||
|
local success, code, result = weaschem.parse_header(content)
|
||||||
|
assert.are.same(false, success)
|
||||||
|
assert.are.same("HEADER_NO_SIZE", code)
|
||||||
|
assert.are.same("string", type(result))
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- TODO: Test invalid sizes/offsets, but this is mainly handled by the above
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue