assert_equal('./test/test_assert-gooder.lua:'..curline(-2)..': '..'assertion failed! bad local \'a\' (string expected, but got number: 2)',msg)
end)
SUITE:addTest('upvalue variable',function()
locala=2
local_,msg=pcall(function()
assert(type(a)=='string')
end)
assert_equal('./test/test_assert-gooder.lua:'..curline(-2)..': '..'assertion failed! bad upvalue \'a\' (string expected, but got number: 2)',msg)
end)
SUITE:addTest('global variable',function()
a=2
local_,msg=pcall(function()
assert(type(a)=='string')
end)
assert_equal('./test/test_assert-gooder.lua:'..curline(-2)..': '..'assertion failed! bad global \'a\' (string expected, but got number: 2)',msg)
end)
SUITE:addTest('argument to anon function',function()
local_,msg=pcall(function(a)
assert(type(a)=='string')
end,2)
assert_equal('./test/test_assert-gooder.lua:'..curline(-2)..': '..'assertion failed! bad argument #1 \'a\' to anonymous function (string expected, but got number: 2)',msg)
end)
SUITE:addTest('argument to named function',function()
localf=function(a)
assert(type(a)=='string')
end
local_,msg=pcall(function()f(2)end)
assert_equal('./test/test_assert-gooder.lua:'..curline(-3)..': '..'assertion failed! bad argument #1 \'a\' to \'f\' (string expected, but got number: 2)',msg)