1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
require 'luacov'
local M = require 'moses'
describe('Import specs', function()
it('imports all library function to a given context', function()
local funcs = M.functions()
local context = M.import({})
assert.is_true(M.all(funcs, function(n) return M.has(context, n) end))
end)
it('passing "noConflict" will preserve already existing keys', function()
local funcs = M.functions()
local context = M.import({each = 1, all = 2}, true)
assert.is_true(M.all(funcs, function(n) return M.has(context, n) end))
assert.equal(context.each, 1)
assert.equal(context.all, 2)
end)
end)
|