parse_abs_axis_name: add tests for multiple axes at a time

This commit is contained in:
Starbeamrainbowlabs 2021-11-07 18:06:05 +00:00
parent 96c3ede365
commit be81e6dfaa
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -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)