robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
885 B34 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3
4local describe, it, setup = t.describe, t.it, t.setup
5local eq = t.eq
6local clear = n.clear
7local command = n.command
8local pcall_err = t.pcall_err
9
10setup(clear)
11
12describe('uniq()', function()
13  it('errors out when processing special values', function()
14    eq(
15      'Vim(call):E362: Using a boolean value as a Float',
16      pcall_err(command, 'call uniq([v:true, v:false], "f")')
17    )
18  end)
19
20  it('can yield E882 and stop filtering after that', function()
21    command([[
22      function Cmp(a, b)
23        if type(a:a) == type([]) || type(a:b) == type([])
24          return []
25        endif
26        return (a:a > a:b) - (a:a < a:b)
27      endfunction
28    ]])
29    eq(
30      'Vim(let):E745: Using a List as a Number',
31      pcall_err(command, 'let fl = uniq([0, 0, [], 1, 1], "Cmp")')
32    )
33  end)
34end)