mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-23 03:55:01 +00:00
parse_abs_axis_name: add tests for multiple axes at a time
This commit is contained in:
parent
96c3ede365
commit
be81e6dfaa
1 changed files with 17 additions and 1 deletions
|
@ -45,7 +45,7 @@ describe("parse_abs_axis_name", function()
|
||||||
result
|
result
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
it("should work with negative x", function()
|
it("should work with negative z", function()
|
||||||
local success, result = parse_abs_axis_name("-z")
|
local success, result = parse_abs_axis_name("-z")
|
||||||
assert.is_true(success)
|
assert.is_true(success)
|
||||||
assert.are.same(
|
assert.are.same(
|
||||||
|
@ -53,6 +53,22 @@ describe("parse_abs_axis_name", function()
|
||||||
result
|
result
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
it("should work with multiple axes -x y", function()
|
||||||
|
local success, result = parse_abs_axis_name("-xy")
|
||||||
|
assert.is_true(success)
|
||||||
|
assert.are.same(
|
||||||
|
Vector3.new(-1, 1, 0),
|
||||||
|
result
|
||||||
|
)
|
||||||
|
end)
|
||||||
|
it("should work with multiple axes z-y", function()
|
||||||
|
local success, result = parse_abs_axis_name("z-y")
|
||||||
|
assert.is_true(success)
|
||||||
|
assert.are.same(
|
||||||
|
Vector3.new(0, -1, 1),
|
||||||
|
result
|
||||||
|
)
|
||||||
|
end)
|
||||||
it("returns an error with invalid input", function()
|
it("returns an error with invalid input", function()
|
||||||
local success, result = parse_abs_axis_name("cheese")
|
local success, result = parse_abs_axis_name("cheese")
|
||||||
assert.is_false(success)
|
assert.is_false(success)
|
||||||
|
|
Loading…
Reference in a new issue