mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
Fix some line length warnings
This commit is contained in:
@@ -40,8 +40,12 @@ describe("tests related to mutexes", function()
|
||||
:description "Print additional debug information. "
|
||||
)
|
||||
|
||||
assert.has_error(function() parser:parse{"-qv"} end, "option '-v' can not be used together with option '-q'")
|
||||
assert.has_error(function() parser:parse{"-v", "--quiet"} end, "option '--quiet' can not be used together with option '-v'")
|
||||
assert.has_error(function()
|
||||
parser:parse{"-qv"}
|
||||
end, "option '-v' can not be used together with option '-q'")
|
||||
assert.has_error(function()
|
||||
parser:parse{"-v", "--quiet"}
|
||||
end, "option '--quiet' can not be used together with option '-v'")
|
||||
end)
|
||||
|
||||
it("handles multiple mutexes", function()
|
||||
@@ -75,6 +79,8 @@ describe("tests related to mutexes", function()
|
||||
|
||||
local args = parser:parse{"install", "-l"}
|
||||
assert.same({install = true, ["local"] = true}, args)
|
||||
assert.has_error(function() parser:parse{"install", "-qlv"} end, "option '-v' can not be used together with option '-q'")
|
||||
assert.has_error(function()
|
||||
parser:parse{"install", "-qlv"}
|
||||
end, "option '-v' can not be used together with option '-q'")
|
||||
end)
|
||||
end)
|
||||
|
@@ -275,13 +275,17 @@ describe("tests related to options", function()
|
||||
it("handles too many arguments correctly", function()
|
||||
local parser = Parser()
|
||||
parser:option "-s" "--server"
|
||||
assert.has_error(function() parser:parse{"-sfoo", "bar"} end, "too many arguments")
|
||||
assert.has_error(function()
|
||||
parser:parse{"-sfoo", "bar"}
|
||||
end, "too many arguments")
|
||||
end)
|
||||
|
||||
it("doesn't accept GNU-like long options when it doesn't need arguments", function()
|
||||
local parser = Parser()
|
||||
parser:flag "-q" "--quiet"
|
||||
assert.has_error(function() parser:parse{"--quiet=very_quiet"} end, "option '--quiet' does not take arguments")
|
||||
assert.has_error(function()
|
||||
parser:parse{"--quiet=very_quiet"}
|
||||
end, "option '--quiet' does not take arguments")
|
||||
end)
|
||||
|
||||
it("handles too many invocations correctly", function()
|
||||
@@ -290,7 +294,9 @@ describe("tests related to options", function()
|
||||
count = 1,
|
||||
overwrite = false
|
||||
}
|
||||
assert.has_error(function() parser:parse{"-qq"} end, "option '-q' must be used 1 time")
|
||||
assert.has_error(function()
|
||||
parser:parse{"-qq"}
|
||||
end, "option '-q' must be used 1 time")
|
||||
end)
|
||||
|
||||
it("handles too few invocations correctly", function()
|
||||
@@ -298,8 +304,12 @@ describe("tests related to options", function()
|
||||
parser:option "-f" "--foo" {
|
||||
count = "3-4"
|
||||
}
|
||||
assert.has_error(function() parser:parse{"-fFOO", "--foo=BAR"} end, "option '--foo' must be used at least 3 times")
|
||||
assert.has_error(function() parser:parse{} end, "missing option '-f'")
|
||||
assert.has_error(function()
|
||||
parser:parse{"-fFOO", "--foo=BAR"}
|
||||
end, "option '--foo' must be used at least 3 times")
|
||||
assert.has_error(
|
||||
function() parser:parse{}
|
||||
end, "missing option '-f'")
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@@ -827,7 +827,8 @@ function ElementState:invoke(alias)
|
||||
if self.element._overwrite then
|
||||
self.overwrite = true
|
||||
else
|
||||
self:error("%s must be used %s", self.name, bound("time", self.element._mincount, self.element._maxcount, true))
|
||||
local num_times_repr = bound("time", self.element._mincount, self.element._maxcount, true)
|
||||
self:error("%s must be used %s", self.name, num_times_repr)
|
||||
end
|
||||
else
|
||||
self.invocations = self.invocations + 1
|
||||
|
Reference in New Issue
Block a user