Add 'concat' action

This commit is contained in:
mpeterv
2015-10-31 19:30:55 +03:00
parent 38b6eb1392
commit 4fb2991fb2
2 changed files with 13 additions and 2 deletions

View File

@@ -100,9 +100,10 @@ describe("actions", function()
local parser = Parser()
parser:flag("--no-foo"):target("foo"):action("store_false")
parser:flag("--no-bar"):target("bar"):action("store_false")
parser:option("--things"):args("+"):count("*"):action("concat")
local args = parser:parse{"--no-foo"}
assert.same({foo = false}, args)
local args = parser:parse{"--things", "a", "b", "--no-foo", "--things", "c", "d"}
assert.same({foo = false, things = {"a", "b", "c", "d"}}, args)
end)
it("for options allow setting initial stored value", function()