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.is_false(ok)
|
||||||
assert.equal("too few arguments", errmsg)
|
assert.equal("too few arguments", errmsg)
|
||||||
end)
|
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)
|
end)
|
||||||
|
@@ -778,6 +778,7 @@ function Parser:pparse(args)
|
|||||||
if ok then
|
if ok then
|
||||||
return true, result
|
return true, result
|
||||||
else
|
else
|
||||||
|
assert(errmsg, result)
|
||||||
return false, errmsg
|
return false, errmsg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user