Add argument choices

This commit is contained in:
Paul Ouellette
2019-05-27 17:54:05 -04:00
parent d08b637d54
commit dcd5162710
6 changed files with 64 additions and 0 deletions

View File

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