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
This commit is contained in:
Jan Edmund Lazo
2021-04-08 19:20:50 -04:00
parent 0d0eeff8a3
commit cfeaea0d3e
2 changed files with 38 additions and 1 deletions

View File

@@ -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

View File

@@ -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()