Skip to content

Commit

Permalink
fix(tests) fix tests failing on Lua 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Jul 28, 2020
1 parent a50b13b commit 08665b3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/lua/mod52.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ local _ENV,M = require 'pl.import_into' (rawget(_G,'STRICT'))
function answer ()
-- of course, you don't have the usual global environment available
-- so define it as a local up above, or use utils.import(_G).

local versioned_errors = {
["1"] = "attempt to call global 'print'",
["2"] = "attempt to call global 'print'",
["3"] = "attempt to call a nil value",
["4"] = "attempt to call a nil value",
}
local expected = versioned_errors[LUA_VERSION:match("Lua 5.(%d)")]
test.assertraise(function()
print 'hello'
end,(LUA_VERSION~="Lua 5.3") and "attempt to call global 'print'" or "attempt to call a nil value")
end, expected)

-- but all the Penlight modules are available
return pretty.write(utils.split '10 20 30', '')
Expand Down

0 comments on commit 08665b3

Please sign in to comment.