Mercurial > prosody-hg
diff spec/util_argparse_spec.lua @ 12477:cc84682b8429 0.12
util.argparse: Revise 553c6204fe5b with a different approach
The second return value is (not insensibly) assumed to be an error. Instead of
returning a value there in the success case, copy the positional arguments
into the existing opts table.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 25 Apr 2022 15:24:56 +0100 |
| parents | 97c1399720c2 |
| children | 4ee9a912ceea |
line wrap: on
line diff
--- a/spec/util_argparse_spec.lua Mon Apr 25 15:09:41 2022 +0100 +++ b/spec/util_argparse_spec.lua Mon Apr 25 15:24:56 2022 +0100 @@ -20,7 +20,7 @@ local arg = { "--foo"; "bar"; "--baz" }; local opts, err = parse(arg); assert.falsy(err); - assert.same({ foo = true }, opts); + assert.same({ foo = true, "bar", "--baz" }, opts); assert.same({ "bar"; "--baz" }, arg); end);
