aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-08 19:20:50 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-08 22:39:28 -0400
commitcfeaea0d3eb3f13a6f3c59f8d270082d9d2ec3b1 (patch)
treeb8ec68a88a29a00fcfc015ca7aa0e0bd75635c6b
parent0d0eeff8a34b01db93fb271fbeac3ad2d372a0e0 (diff)
downloadrneovim-cfeaea0d3eb3f13a6f3c59f8d270082d9d2ec3b1.tar.gz
rneovim-cfeaea0d3eb3f13a6f3c59f8d270082d9d2ec3b1.tar.bz2
rneovim-cfeaea0d3eb3f13a6f3c59f8d270082d9d2ec3b1.zip
vim-patch:8.2.1822: list test doesn't fail
Problem: List test doesn't fail. Solution: Adjust the test for NULL list handling. https://github.com/vim/vim/commit/f57497276bc616d3856eeff9824c080941faa51b 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
-rw-r--r--src/nvim/testdir/test_listdict.vim37
-rw-r--r--src/nvim/testdir/test_utf8.vim2
2 files changed, 38 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_listdict.vim b/src/nvim/testdir/test_listdict.vim
index 9b871b5707..f9410fb620 100644
--- a/src/nvim/testdir/test_listdict.vim
+++ b/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
diff --git a/src/nvim/testdir/test_utf8.vim b/src/nvim/testdir/test_utf8.vim
index e8161f8fcb..c51fb3a759 100644
--- a/src/nvim/testdir/test_utf8.vim
+++ b/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()