robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

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