neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

container_functions_spec.lua (684B)


      1 local t = require('test.testutil')
      2 local n = require('test.functional.testnvim')()
      3 
      4 local eq = t.eq
      5 local eval = n.eval
      6 local api = n.api
      7 local clear = n.clear
      8 
      9 before_each(clear)
     10 
     11 describe('extend()', function()
     12  it('succeeds to extend list with itself', function()
     13    api.nvim_set_var('l', { 1, {} })
     14    eq({ 1, {}, 1, {} }, eval('extend(l, l)'))
     15    eq({ 1, {}, 1, {} }, api.nvim_get_var('l'))
     16 
     17    api.nvim_set_var('l', { 1, {} })
     18    eq({ 1, {}, 1, {} }, eval('extend(l, l, 0)'))
     19    eq({ 1, {}, 1, {} }, api.nvim_get_var('l'))
     20 
     21    api.nvim_set_var('l', { 1, {} })
     22    eq({ 1, 1, {}, {} }, eval('extend(l, l, 1)'))
     23    eq({ 1, 1, {}, {} }, api.nvim_get_var('l'))
     24  end)
     25 end)