From caf69bc943ebcdec3edf53b84128451334cdeb8a Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Sat, 17 Mar 2018 14:09:54 +0300 Subject: [PATCH] Add a test for concat action + overwrite interaction --- spec/actions_spec.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/actions_spec.lua b/spec/actions_spec.lua index f5a37fb..b94d8af 100644 --- a/spec/actions_spec.lua +++ b/spec/actions_spec.lua @@ -130,6 +130,15 @@ describe("actions", function() assert.same({f = {"123"}, g = {"abc", "def", "123"}}, args) end) + it("'concat' action can't handle too many invocations", function() + local parser = Parser() + parser:option("-x"):args("*"):count("0-2"):action("concat") + + assert.has_error(function() + parser:parse{"-x", "foo", "-x", "bar", "baz", "-x", "thing"} + end, "'concat' action can't handle too many invocations") + end) + it("for options allow setting initial stored value as non-string argument to default", function() local parser = Parser() parser:flag("--no-foo", "Foo the bar.", true):target("foo"):action("store_false")