Browse Source

vim-patch:8.2.1822: list test doesn't fail

Problem:    List test doesn't fail.
Solution:   Adjust the test for NULL list handling.
f57497276b

Comment out test cases that modify null lists
because Neovim throws error messages instead of silently failing.
Null lists should be read-only and constant.
https://github.com/neovim/neovim/issues/4615
pull/14326/head
Jan Edmund Lazo 1 month ago
parent
commit
cfeaea0d3e
No known key found for this signature in database GPG Key ID: 64915E6E9F735B15
  1. 37
      src/nvim/testdir/test_listdict.vim
  2. 2
      src/nvim/testdir/test_utf8.vim

37
src/nvim/testdir/test_listdict.vim

@ -791,3 +791,40 @@ func Test_scope_dict()
" Test for v:
call s:check_scope_dict('v', v:true)
endfunc
" Test for a null list
func Test_null_list()
let l = v:_null_list
call assert_equal('', join(l))
call assert_equal(0, len(l))
call assert_equal(1, empty(l))
call assert_fails('let s = join([1, 2], [])', 'E730:')
call assert_equal([], split(v:_null_string))
call assert_equal([], l[:2])
call assert_true([] == l)
call assert_equal('[]', string(l))
" call assert_equal(0, sort(l))
" call assert_equal(0, sort(l))
" call assert_equal(0, uniq(l))
let k = [] + l
call assert_equal([], k)
let k = l + []
call assert_equal([], k)
call assert_equal(0, len(copy(l)))
call assert_equal(0, count(l, 5))
call assert_equal([], deepcopy(l))
call assert_equal(5, get(l, 2, 5))
call assert_equal(-1, index(l, 2, 5))
" call assert_equal(0, insert(l, 2, -1))
call assert_equal(0, min(l))
call assert_equal(0, max(l))
" call assert_equal(0, remove(l, 0, 2))
call assert_equal([], repeat(l, 2))
" call assert_equal(0, reverse(l))
" call assert_equal(0, sort(l))
call assert_equal('[]', string(l))
" call assert_equal(0, extend(l, l, 0))
lockvar l
call assert_equal(1, islocked('l'))
unlockvar l
endfunc

2
src/nvim/testdir/test_utf8.vim

@ -84,7 +84,7 @@ func Test_list2str_str2list_utf8()
" Null list is the same as an empty list
call assert_equal('', list2str([]))
" call assert_equal('', list2str(test_null_list()))
call assert_equal('', list2str(v:_null_list))
endfunc
func Test_list2str_str2list_latin1()

Loading…
Cancel
Save