From 93347db1241f8c803c24c6cf615389cb237f0031 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 25 Apr 2022 15:24:56 +0100 Subject: 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. --- spec/util_argparse_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/util_argparse_spec.lua b/spec/util_argparse_spec.lua index 3994a041..0f2430b7 100644 --- a/spec/util_argparse_spec.lua +++ b/spec/util_argparse_spec.lua @@ -20,7 +20,7 @@ describe("parse", function() 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); -- cgit v1.2.3