diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-15 22:29:17 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-15 22:29:17 +0200 |
commit | ffdf8adfa8108d4765fdc68abbd2fe49a4292b25 (patch) | |
tree | b82cf803d463b30816a79eb8a2d3a401259cf04b /src/testdir | |
parent | 27491cd3ef86c10a2b64bcb657f29e1d0fccb183 (diff) |
patch 8.2.1852: map() returing zero for NULL list is unexpectedv8.2.1852
Problem: map() returing zero for NULL list is unexpected.
Solution: Return the empty list. (closes #7133)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_blob.vim | 1 | ||||
-rw-r--r-- | src/testdir/test_filter_map.vim | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim index 69b3504799..3eff715d05 100644 --- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -271,6 +271,7 @@ endfunc " filter() item in blob func Test_blob_filter() + call assert_equal(test_null_blob(), filter(test_null_blob(), '0')) call assert_equal(0z, filter(0zDEADBEEF, '0')) call assert_equal(0zADBEEF, filter(0zDEADBEEF, 'v:val != 0xDE')) call assert_equal(0zDEADEF, filter(0zDEADBEEF, 'v:val != 0xBE')) diff --git a/src/testdir/test_filter_map.vim b/src/testdir/test_filter_map.vim index 249c32f126..e6587c23bd 100644 --- a/src/testdir/test_filter_map.vim +++ b/src/testdir/test_filter_map.vim @@ -98,10 +98,10 @@ func Test_map_filter_fails() call assert_fails("let l = filter([1, 2, 3], '{}')", 'E728:') call assert_fails("let l = filter({'k' : 10}, '{}')", 'E728:') call assert_fails("let l = filter([1, 2], {})", 'E731:') - call assert_equal(0, filter(test_null_list(), 0)) - call assert_equal(0, filter(test_null_dict(), 0)) - call assert_equal(0, map(test_null_list(), '"> " .. v:val')) - call assert_equal(0, map(test_null_dict(), '"> " .. v:val')) + call assert_equal(test_null_list(), filter(test_null_list(), 0)) + call assert_equal(test_null_dict(), filter(test_null_dict(), 0)) + call assert_equal(test_null_list(), map(test_null_list(), '"> " .. v:val')) + call assert_equal(test_null_dict(), map(test_null_dict(), '"> " .. v:val')) call assert_equal([1, 2, 3], filter([1, 2, 3], test_null_function())) call assert_fails("let l = filter([1, 2], function('min'))", 'E118:') call assert_equal([1, 2, 3], filter([1, 2, 3], test_null_partial())) |