summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-04 12:23:06 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-04 12:23:06 +0100
commit64ffa9b5fb34adb0b20fc22e8127604274bc3010 (patch)
tree1af064858c44b80175a8c2e28609dce2c7378ffc
parent9c13f76275047a4d6302c077fb40bc9c397ff027 (diff)
downloadvim-git-64ffa9b5fb34adb0b20fc22e8127604274bc3010.tar.gz
patch 8.2.1951: test for list and dict failsv8.2.1951
Problem: Test for list and dict fails. Solution: Adjust for using an empty list/dict for a null one.
-rw-r--r--src/testdir/test_listdict.vim41
-rw-r--r--src/testdir/test_python2.vim4
-rw-r--r--src/testdir/test_python3.vim5
-rw-r--r--src/version.c2
4 files changed, 33 insertions, 19 deletions
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index 6a7fc4c68..762a51708 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -1000,7 +1000,8 @@ endfunc
" Test for a null list
func Test_null_list()
let l = test_null_list()
- call assert_equal(0, join(l))
+ call assert_equal(0, join(test_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:')
@@ -1008,8 +1009,10 @@ func Test_null_list()
call assert_equal([], l[:2])
call assert_true([] == l)
call assert_equal('[]', string(l))
- call assert_equal(0, sort(l))
- call assert_equal(0, uniq(l))
+ call assert_equal(0, sort(test_null_list()))
+ call assert_equal([], sort(l))
+ call assert_equal(0, uniq(test_null_list()))
+ call assert_equal([], uniq(l))
let k = [] + l
call assert_equal([], k)
let k = l + []
@@ -1019,15 +1022,20 @@ func Test_null_list()
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, insert(test_null_list(), 2, -1))
+ call assert_fails('call insert(l, 2, -1)', 'E684:')
call assert_equal(0, min(l))
call assert_equal(0, max(l))
- call assert_equal(0, remove(l, 0, 2))
+ call assert_equal(0, remove(test_null_list(), 0, 2))
+ call assert_fails('call remove(l, 0, 2)', 'E684:')
call assert_equal([], repeat(l, 2))
- call assert_equal(0, reverse(l))
- call assert_equal(0, sort(l))
+ call assert_equal(0, reverse(test_null_list()))
+ call assert_equal([], reverse(l))
+ call assert_equal(0, sort(test_null_list()))
+ call assert_equal([], sort(l))
call assert_equal('[]', string(l))
- call assert_equal(0, extend(l, l, 0))
+ call assert_fails('call extend(test_null_list(), test_null_list())', 'E1134:')
+ call assert_equal([], extend(l, l, 0))
lockvar l
call assert_equal(1, islocked('l'))
unlockvar l
@@ -1040,12 +1048,15 @@ func Test_null_dict()
call assert_equal({}, d)
call assert_equal(0, len(d))
call assert_equal(1, empty(d))
- call assert_equal(0, items(d))
- call assert_equal(0, keys(d))
- call assert_equal(0, values(d))
+ call assert_equal(0, items(test_null_dict()))
+ call assert_equal([], items(d))
+ call assert_equal(0, keys(test_null_dict()))
+ call assert_equal([], keys(d))
+ call assert_equal(0, values(test_null_dict()))
+ call assert_equal([], values(d))
call assert_false(has_key(d, 'k'))
call assert_equal('{}', string(d))
- call assert_fails('let x = d[10]')
+ call assert_fails('let x = d[10]', 'E716:')
call assert_equal({}, {})
call assert_equal(0, len(copy(d)))
call assert_equal(0, count(d, 'k'))
@@ -1053,9 +1064,11 @@ func Test_null_dict()
call assert_equal(20, get(d, 'k', 20))
call assert_equal(0, min(d))
call assert_equal(0, max(d))
- call assert_equal(0, remove(d, 'k'))
+ call assert_equal(0, remove(test_null_dict(), 'k'))
+ call assert_fails("call remove(d, 'k')", 'E716:')
call assert_equal('{}', string(d))
- call assert_equal(0, extend(d, d, 0))
+ call assert_fails('call extend(test_null_dict(), test_null_dict())', 'E1133:')
+ call assert_equal({}, extend(d, d, 'keep'))
lockvar d
call assert_equal(1, islocked('d'))
unlockvar d
diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim
index fd8fe70e4..ba73c1232 100644
--- a/src/testdir/test_python2.vim
+++ b/src/testdir/test_python2.vim
@@ -353,12 +353,12 @@ func Test_python_list()
call AssertException(["py t = vim.eval('[test_null_list()]')"],
\ 'Vim(python):SystemError: error return without exception set')
- " Try to bind a null List variable
+ " Try to bind a null List variable (works because an empty list is used)
let cmds =<< trim END
let l = test_null_list()
py ll = vim.bindeval('l')
END
- call AssertException(cmds, 'Vim(python):SystemError: error return without exception set')
+ call AssertException(cmds, '')
let l = []
py l = vim.bindeval('l')
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim
index f05fc0702..660ac461d 100644
--- a/src/testdir/test_python3.vim
+++ b/src/testdir/test_python3.vim
@@ -545,13 +545,12 @@ func Test_python3_list()
call AssertException(["py3 t = vim.eval('[test_null_list()]')"],
\ 'Vim(py3):SystemError: <built-in function eval> returned NULL without setting an error')
- " Try to bind a null List variable
+ " Try to bind a null List variable (works because an empty list is used)
let cmds =<< trim END
let l = test_null_list()
py3 ll = vim.bindeval('l')
END
- call AssertException(cmds,
- \ 'Vim(py3):SystemError: <built-in function bindeval> returned NULL without setting an error')
+ call AssertException(cmds, '')
let l = []
py3 l = vim.bindeval('l')
diff --git a/src/version.c b/src/version.c
index 150bfd23b..d677744ee 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1951,
+/**/
1950,
/**/
1949,