File: import_spec.lua

package info (click to toggle)
lua-moses 2.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 764 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (3)
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)