Add a test for help generation with long option argument list

This commit is contained in:
Peter Melnichenko
2018-04-08 15:14:46 +03:00
parent 8baabbbe23
commit 7e1ee83a0b

View File

@@ -155,6 +155,24 @@ Options:
-h, --help Show this help message and exit.]], parser:get_help()) -h, --help Show this help message and exit.]], parser:get_help())
end) end)
it("handles very long argument lists", function()
local parser = Parser "foo"
parser:option "-t --at-least-three"
:args("3+")
:argname {"<foo>", "<bar>", "<baz>"}
:description "Sometimes argument lists are really long."
assert.equal([[
Usage: foo [-h] [-t <foo> <bar> <baz> ...]
Options:
-t <foo> <bar> <baz> ...,
--at-least-three <foo> <bar> <baz> ...
Sometimes argument lists are really long.
-h, --help Show this help message and exit.]], parser:get_help())
end)
it("shows default values", function() it("shows default values", function()
local parser = Parser "foo" local parser = Parser "foo"
parser:option "-o" parser:option "-o"