Fixed exploded tests to work with busted 2.0

This commit is contained in:
mpeterv
2014-08-01 17:44:15 +04:00
parent d1386c1d96
commit 59603d5f39
13 changed files with 13 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to actions", function()
it("calls actions for options", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to positional arguments", function()
describe("passing correct arguments", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to commands", function()
it("handles commands after arguments", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to converters", function()
it("converts arguments", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to default values", function()
describe("default values for arguments", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to help message generation", function()
it("creates correct help message for empty parser", function()

View File

@@ -1,5 +1,3 @@
local Parser = require "argparse"
describe("tests related to CLI behaviour #unsafe", function()
describe("error messages", function()
it("generates correct error message without arguments", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to mutexes", function()
it("handles mutex correctly", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to options", function()
describe("passing correct options", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to :pparse()", function()
it("returns true and result on success", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to tips", function()
describe("provides tips when data is too long", function()

View File

@@ -1,4 +1,5 @@
local Parser = require "argparse"
getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to usage message generation", function()
it("creates correct usage message for empty parser", function()

View File

@@ -941,12 +941,8 @@ function Parser:_parse(args, errhandler)
end
function Parser:error(msg)
if _TEST then
error(msg)
else
io.stderr:write(("%s\r\n\r\nError: %s\r\n"):format(self:get_usage(), msg))
os.exit(1)
end
io.stderr:write(("%s\r\n\r\nError: %s\r\n"):format(self:get_usage(), msg))
os.exit(1)
end
function Parser:parse(args)