mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
more tests
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user