aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2016-12-14 00:26:52 -0700
committerMichael Ennen <mike.ennen@gmail.com>2017-02-14 17:38:16 -0700
commit6c423989fc5becb294dacedceaac0c2e878a3858 (patch)
tree9f7efa2e37ee7e778c236bba11bb9daae8c91b5f /src/nvim/testdir
parentbb2afeb0266ffd410e2e226a376f7ddbac633491 (diff)
downloadrneovim-6c423989fc5becb294dacedceaac0c2e878a3858.tar.gz
rneovim-6c423989fc5becb294dacedceaac0c2e878a3858.tar.bz2
rneovim-6c423989fc5becb294dacedceaac0c2e878a3858.zip
vim-patch:7.4.2002
Problem: Crash when passing number to filter() or map(). Solution: Convert to a string. (Ozaki Kiichi) https://github.com/vim/vim/commit/a06ec8f345eabb66e5b7d7c0192cfebdde63115d
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_filter_map.vim4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_filter_map.vim b/src/nvim/testdir/test_filter_map.vim
index 6bb063c76d..c8d64ce0a4 100644
--- a/src/nvim/testdir/test_filter_map.vim
+++ b/src/nvim/testdir/test_filter_map.vim
@@ -5,10 +5,12 @@ func Test_filter_map_list_expr_string()
" filter()
call assert_equal([2, 3, 4], filter([1, 2, 3, 4], 'v:val > 1'))
call assert_equal([3, 4], filter([1, 2, 3, 4], 'v:key > 1'))
+ call assert_equal([], filter([1, 2, 3, 4], 0))
" map()
call assert_equal([2, 4, 6, 8], map([1, 2, 3, 4], 'v:val * 2'))
call assert_equal([0, 2, 4, 6], map([1, 2, 3, 4], 'v:key * 2'))
+ call assert_equal([9, 9, 9, 9], map([1, 2, 3, 4], 9))
endfunc
" dict with expression string
@@ -18,10 +20,12 @@ func Test_filter_map_dict_expr_string()
" filter()
call assert_equal({"bar": 2, "baz": 3}, filter(copy(dict), 'v:val > 1'))
call assert_equal({"foo": 1, "baz": 3}, filter(copy(dict), 'v:key > "bar"'))
+ call assert_equal({}, filter(copy(dict), 0))
" map()
call assert_equal({"foo": 2, "bar": 4, "baz": 6}, map(copy(dict), 'v:val * 2'))
call assert_equal({"foo": "f", "bar": "b", "baz": "b"}, map(copy(dict), 'v:key[0]'))
+ call assert_equal({"foo": 9, "bar": 9, "baz": 9}, map(copy(dict), 9))
endfunc
" list with funcref