34 lines
1.0 KiB
Lua
34 lines
1.0 KiB
Lua
|
|
local SUITE = require('TestSuite').new('resilience')
|
|
SUITE:setEnviroment{
|
|
--format = require('pretty')
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
SUITE:addTest('no_std_lib', function ()
|
|
-- This tests whether one could load the library with an empty env, without
|
|
-- an error.
|
|
local chunk = loadfile('./library.lua')
|
|
setfenv(chunk, {})
|
|
local library = chunk()
|
|
|
|
for func, func_info in pairs(library) do
|
|
error(('For some reason %s is defined in the library'):format(func_info.name))
|
|
end
|
|
end)
|
|
|
|
SUITE:addTest('a_very_small_part_of_math', function ()
|
|
-- This tests whether one could load the library with an empty env, without
|
|
-- an error.
|
|
local chunk = loadfile('./library.lua')
|
|
setfenv(chunk, { math = { abs = math.abs } })
|
|
local library = chunk()
|
|
|
|
assert( library[math.abs], 'Why is math.abs not defined in the library?' )
|
|
end)
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
return SUITE
|