Welcome to mirror list, hosted at ThFree Co, Russian Federation.

import_spec.lua « spec - github.com/Yonaba/Moses.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1c11c7af03da83c1dbc323562f45ea5b777b039a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--require 'luacov'
local _ = require 'moses'

context('Import specs', function()
  
  test('imports all library function to a given context', function()
    local funcs = _.functions()
    local context = _.import({})
    assert_true(_.all(funcs, function(n) return _.has(context, n) end))
  end)

  test('passing "noConflict" will preserve already existing keys', function()
    local funcs = _.functions()
    local context = _.import({each = 1, all = 2}, true)
    assert_true(_.all(funcs, function(n) return _.has(context, n) end))
    assert_equal(context.each, 1)
    assert_equal(context.all, 2)
  end)
  
end)