Added mutually exclusive groups

This commit is contained in:
mpeterv
2014-03-09 14:28:55 +04:00
parent fae3fb4500
commit 7bf5777413
4 changed files with 141 additions and 2 deletions

View File

@@ -158,4 +158,25 @@ describe("tests related to usage message generation", function()
)
end)
end)
it("creates correct usage message for mutexes", function()
local parser = Parser "foo"
:add_help(false)
parser:mutex(
parser:flag "-q" "--quiet",
parser:flag "-v" "--verbose",
parser:flag "-i" "--interactive"
)
parser:mutex(
parser:flag "-l" "--local",
parser:option "-f" "--from"
)
parser:option "--yet-another-option"
assert.equal(table.concat({
"Usage: foo ([-q] | [-v] | [-i]) ([-l] | [-f <from>])",
" [--yet-another-option <yet-another-option>]"
}, "\r\n"), parser:get_usage()
)
end)
end)