mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
:pparse() should still raise an error if it is caused by misconfiguration
This commit is contained in:
@@ -16,4 +16,11 @@ describe("tests related to :pparse()", function()
|
||||
assert.is_false(ok)
|
||||
assert.equal("too few arguments", errmsg)
|
||||
end)
|
||||
|
||||
it("still raises an error if it is caused by misconfiguration", function()
|
||||
local parser = Parser()
|
||||
parser:option "--foo"
|
||||
:count "a lot"
|
||||
assert.has_error(function() parser:pparse{} end)
|
||||
end)
|
||||
end)
|
||||
|
@@ -778,6 +778,7 @@ function Parser:pparse(args)
|
||||
if ok then
|
||||
return true, result
|
||||
else
|
||||
assert(errmsg, result)
|
||||
return false, errmsg
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user