Fix some line length warnings

This commit is contained in:
Peter Melnichenko
2018-03-17 13:34:50 +03:00
parent 3a43d528c6
commit 4d06371a07
3 changed files with 26 additions and 9 deletions

View File

@@ -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)

View File

@@ -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)