mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
return Parser as the module
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
local argparse = require "argparse"
|
||||
local Parser = require "argparse"
|
||||
|
||||
describe("tests related to converters", function()
|
||||
it("converts arguments", function()
|
||||
local parser = argparse.parser()
|
||||
local parser = Parser()
|
||||
parser:argument "numbers" {
|
||||
convert = tonumber,
|
||||
args = "+"
|
||||
@@ -13,7 +13,7 @@ describe("tests related to converters", function()
|
||||
end)
|
||||
|
||||
it("raises an error when it can't convert", function()
|
||||
local parser = argparse.parser()
|
||||
local parser = Parser()
|
||||
parser:argument "numbers" {
|
||||
convert = tonumber,
|
||||
args = "+"
|
||||
@@ -23,7 +23,7 @@ describe("tests related to converters", function()
|
||||
end)
|
||||
|
||||
it("second return value is used as error message", function()
|
||||
local parser = argparse.parser()
|
||||
local parser = Parser()
|
||||
parser:argument "numbers" {
|
||||
convert = function(x) return tonumber(x), x .. " is not a number" end
|
||||
}
|
||||
|
Reference in New Issue
Block a user