mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-10-02 07:02:29 +00:00
Refactoring: added sanity checks in setters
This commit is contained in:
@@ -7,10 +7,10 @@ describe("tests related to actions", function()
|
||||
|
||||
local parser = Parser()
|
||||
parser:option "-f" "--from" {
|
||||
action = action1
|
||||
action = function(...) return action1(...) end
|
||||
}
|
||||
parser:option "-p" "--pair" {
|
||||
action = action2,
|
||||
action = function(...) return action2(...) end,
|
||||
count = "*",
|
||||
args = 2
|
||||
}
|
||||
@@ -28,14 +28,14 @@ describe("tests related to actions", function()
|
||||
|
||||
local parser = Parser()
|
||||
parser:flag "-v" "--verbose" {
|
||||
action = action1,
|
||||
action = function(...) return action1(...) end,
|
||||
count = "0-3"
|
||||
}
|
||||
parser:flag "-q" "--quiet" {
|
||||
action = action2
|
||||
action = function(...) return action2(...) end
|
||||
}
|
||||
parser:flag "-a" "--another-flag" {
|
||||
action = action3
|
||||
action = function(...) return action3(...) end
|
||||
}
|
||||
|
||||
local args = parser:parse{"-vv", "--quiet"}
|
||||
@@ -53,7 +53,7 @@ describe("tests related to actions", function()
|
||||
count = "0-3"
|
||||
}
|
||||
local add = parser:command "add" {
|
||||
action = action
|
||||
action = function(...) return action(...) end
|
||||
}
|
||||
add:argument "something"
|
||||
|
||||
|
@@ -20,7 +20,7 @@ describe("tests related to :pparse()", function()
|
||||
it("still raises an error if it is caused by misconfiguration", function()
|
||||
local parser = Parser()
|
||||
parser:option "--foo"
|
||||
:count "a lot"
|
||||
:aliases {1, 2, 3}
|
||||
assert.has_error(function() parser:pparse{} end)
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user