more tests

This commit is contained in:
mpeterv
2014-01-06 15:08:33 +04:00
parent afc3517175
commit aa0d5eae6d
3 changed files with 57 additions and 4 deletions

View File

@@ -59,6 +59,20 @@ describe("tests related to positional arguments", function()
args = parser:parse({"bar", "baz", "qu"})
assert.same(args, {foo1 = {"bar", "baz"}, foo2 = {"qu"}})
end)
it("handles hyphen correctly", function()
local parser = largparse.parser()
parser:argument "foo"
local args = parser:parse({"-"})
assert.same(args, {foo = "-"})
end)
it("handles double hyphen correctly", function()
local parser = largparse.parser()
parser:argument "foo"
local args = parser:parse({"--", "-q"})
assert.same(args, {foo = "-q"})
end)
end)
describe("passing incorrect arguments", function()
@@ -161,4 +175,4 @@ describe("tests related to positional arguments", function()
assert.has_error(curry(parser.parse, parser, {}), "too few arguments")
end)
end)
end)
end)