Finished working on new interface and stuff

This commit is contained in:
mpeterv
2014-01-18 13:12:56 +04:00
parent dafff3d63e
commit d492dc5e0f
9 changed files with 264 additions and 690 deletions

View File

@@ -77,16 +77,6 @@ describe("tests related to positional arguments", function()
end)
describe("passing incorrect arguments", function()
local old_parser = argparse.parser
setup(function()
argparse.parser = old_parser:extends()
function argparse.parser:error(fmt, ...)
error(fmt:format(...))
end
end)
it("handles extra arguments with empty parser correctly", function()
local parser = argparse.parser()
@@ -132,17 +122,17 @@ describe("tests related to positional arguments", function()
it("handles too few arguments with multi-argument correctly", function()
local parser = argparse.parser()
parser:argument("foo", {
parser:argument "foo" {
args = "+"
})
}
assert.has_error(curry(parser.parse, parser, {}), "too few arguments")
end)
it("handles too many arguments with multi-argument correctly", function()
local parser = argparse.parser()
parser:argument("foo", {
parser:argument "foo" {
args = "2-4"
})
}
assert.has_error(curry(parser.parse, parser, {"foo", "bar", "baz", "qu", "quu"}), "too many arguments")
end)