aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-27 00:00:01 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-02-27 07:53:17 +0800
commit1f8cef53deb4b91a7249affca77bfb89ce0949b4 (patch)
tree6ae8e0d31bc4b08ffbd931061255e6cb1ade485d /src/nvim/testdir
parent13da3d469ae10201de00ae89277c53c40342f4df (diff)
downloadrneovim-1f8cef53deb4b91a7249affca77bfb89ce0949b4.tar.gz
rneovim-1f8cef53deb4b91a7249affca77bfb89ce0949b4.tar.bz2
rneovim-1f8cef53deb4b91a7249affca77bfb89ce0949b4.zip
vim-patch:9.0.0204: indexof() may leak memory
Problem: indexof() may leak memory. Solution: Free allocated values. (Yegappan Lakshmanan, closes vim/vim#10916) https://github.com/vim/vim/commit/63acae13f57c5ad4c8ec3146d0c458550b9e984e Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_blob.vim1
-rw-r--r--src/nvim/testdir/test_listdict.vim6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_blob.vim b/src/nvim/testdir/test_blob.vim
index 4c5632c81f..cf03d2011c 100644
--- a/src/nvim/testdir/test_blob.vim
+++ b/src/nvim/testdir/test_blob.vim
@@ -372,6 +372,7 @@ func Test_indexof()
call assert_equal(-1, indexof(b, {i, v -> v == 0x1}))
call assert_equal(1, indexof(b, "v:val == 0xad"))
call assert_equal(-1, indexof(b, "v:val == 0xff"))
+ call assert_equal(-1, indexof(b, {_, v -> "v == 0xad"}))
call assert_equal(-1, indexof(0z, "v:val == 0x0"))
call assert_equal(-1, indexof(v:_null_blob, "v:val == 0xde"))
diff --git a/src/nvim/testdir/test_listdict.vim b/src/nvim/testdir/test_listdict.vim
index 4c51119d16..37c1ee8307 100644
--- a/src/nvim/testdir/test_listdict.vim
+++ b/src/nvim/testdir/test_listdict.vim
@@ -1083,7 +1083,13 @@ func Test_indexof()
call assert_equal(-1, indexof(l, "v:val.n == 10", #{startidx: -4}))
call assert_equal(0, indexof(l, "v:val.n == 10", v:_null_dict))
+ let s = ["a", "b", "c"]
+ call assert_equal(2, indexof(s, {_, v -> v == 'c'}))
+ call assert_equal(-1, indexof(s, {_, v -> v == 'd'}))
+ call assert_equal(-1, indexof(s, {_, v -> "v == 'd'"}))
+
call assert_equal(-1, indexof([], {i, v -> v == 'a'}))
+ call assert_equal(-1, indexof([1, 2, 3], {_, v -> "v == 2"}))
call assert_equal(-1, indexof(v:_null_list, {i, v -> v == 'a'}))
call assert_equal(-1, indexof(l, v:_null_string))
" Nvim doesn't have null functions