Spec cleanups

This commit is contained in:
mpeterv
2015-03-13 15:19:33 +03:00
parent 0da90dc597
commit 01cc387863
4 changed files with 11 additions and 11 deletions

View File

@@ -3,8 +3,8 @@ getmetatable(Parser()).error = function(_, msg) error(msg) end
describe("tests related to actions", function()
it("calls actions for options", function()
local action1 = spy.new(function(x) end)
local action2 = spy.new(function(x) end)
local action1 = spy.new(function() end)
local action2 = spy.new(function() end)
local parser = Parser()
parser:option "-f" "--from" {
@@ -23,9 +23,9 @@ describe("tests related to actions", function()
end)
it("properly calls actions for flags", function()
local action1 = spy.new(function(x) end)
local action2 = spy.new(function(x) end)
local action3 = spy.new(function(x) end)
local action1 = spy.new(function() end)
local action2 = spy.new(function() end)
local action3 = spy.new(function() end)
local parser = Parser()
parser:flag "-v" "--verbose" {
@@ -47,7 +47,7 @@ describe("tests related to actions", function()
end)
it("calls actions for commands", function()
local action = spy.new(function(x) end)
local action = spy.new(function() end)
local parser = Parser "name"
parser:flag "-v" "--verbose" {

View File

@@ -37,8 +37,8 @@ describe("tests related to commands", function()
it("handles nested commands", function()
local parser = Parser "name"
local foo = parser:command "foo"
local bar = foo:command "bar"
local baz = foo:command "baz"
foo:command "bar"
foo:command "baz"
local args = parser:parse{"foo", "bar"}
assert.same({foo = true, bar = true}, args)
@@ -57,7 +57,7 @@ describe("tests related to commands", function()
it("Detects wrong commands", function()
local parser = Parser "name"
local install = parser:command "install"
parser:command "install"
assert.has_error(function() parser:parse{"run"} end, "unknown command 'run'")
end)

View File

@@ -9,7 +9,7 @@ describe("tests related to default values", function()
:default "bar"
local args = parser:parse{}
assert.same({foo = "bar"}, args)
local args = parser:parse{"baz"}
args = parser:parse{"baz"}
assert.same({foo = "baz"}, args)
end)

View File

@@ -69,7 +69,7 @@ describe("tests related to options", function()
parser:flag("-q", "--quiet")
local args = parser:parse({"--quiet"})
assert.same({quiet = true}, args)
local args = parser:parse({})
args = parser:parse({})
assert.same({}, args)
end)