mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
Add argument choices
This commit is contained in:
@@ -161,5 +161,15 @@ describe("tests related to positional arguments", function()
|
||||
}
|
||||
assert.has_error(function() parser:parse{} end, "missing argument 'foo1'")
|
||||
end)
|
||||
|
||||
it("handles invalid argument choices correctly", function()
|
||||
local parse = Parser()
|
||||
parse:argument "foo" {
|
||||
choices = {"bar", "baz", "qu"}
|
||||
}
|
||||
assert.has_error(function()
|
||||
parse:parse{"foo", "quu"}
|
||||
end, "argument 'foo' must be one of 'bar', 'baz', 'qu'")
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user