Fixed usage messages in subcommands corrupted after several usages

This commit is contained in:
mpeterv
2014-03-01 16:41:14 +04:00
parent 8cefeb1ef7
commit 73467e2836
2 changed files with 21 additions and 2 deletions

View File

@@ -103,6 +103,23 @@ describe("tests related to usage message generation", function()
)
end)
it("usage messages for commands are correct after several :prepare() invocations", function()
local parser = Parser "foo"
:add_help(false)
parser:flag "-q" "--quiet"
local run = parser:command "run"
:add_help(false)
run:option "--where"
parser:prepare()
parser:prepare()
assert.equal(
[=[Usage: foo run [--where <where>]]=],
run:prepare():get_usage()
)
end)
describe("usage generation can be customized", function()
it("uses message provided by user", function()
local parser = Parser "foo"