aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-18 05:09:24 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-18 05:29:05 +0800
commitbb29ef40084e1cea1f35cbbcbac794f41f46d5f8 (patch)
tree4d6b898cb67d3d1aec5d3cd49acdb0be7be07ada /test
parentffb87f4dd992ff23ff66f888dbe1bcc54bd0b012 (diff)
downloadrneovim-bb29ef40084e1cea1f35cbbcbac794f41f46d5f8.tar.gz
rneovim-bb29ef40084e1cea1f35cbbcbac794f41f46d5f8.tar.bz2
rneovim-bb29ef40084e1cea1f35cbbcbac794f41f46d5f8.zip
vim-patch:9.0.1723: Fix regression in {func} argument of reduce()
Problem: Fix regression in {func} argument of reduce() Solution: pass function name as string again Before patch 9.0.0548, passing a string as {func} argument of reduce() is treated as a function name, but after patch 9.0.0548 it is treated as an expression instead, which is useless as reduce() doesn't set any v: variables. This PR restores the behavior of {func} before that patch. Also correct an emsg() call, as e_string_list_or_blob_required doesn't contain format specifiers. closes: vim/vim#12824 https://github.com/vim/vim/commit/ad0c442f1fcc6fe9c433777ee3e5b9e6addc6d69
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_listdict.vim6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim
index abb7f88a7b..354d987c79 100644
--- a/test/old/testdir/test_listdict.vim
+++ b/test/old/testdir/test_listdict.vim
@@ -944,6 +944,10 @@ func Test_reduce()
call assert_equal('Å,s,t,r,ö,m', reduce('Åström', LSTART acc, val LMIDDLE acc .. ',' .. val LEND))
call assert_equal('Å,s,t,r,ö,m', reduce('Åström', LSTART acc, val LMIDDLE acc .. ',' .. val LEND))
call assert_equal(',a,b,c', reduce('abc', LSTART acc, val LMIDDLE acc .. ',' .. val LEND, v:_null_string))
+
+ call assert_equal(0x7d, reduce([0x30, 0x25, 0x08, 0x61], 'or'))
+ call assert_equal(0x7d, reduce(0z30250861, 'or'))
+ call assert_equal('β', reduce('ββββ', 'matchstr'))
END
call CheckLegacyAndVim9Success(lines)
@@ -958,7 +962,7 @@ func Test_reduce()
call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E1098:')
call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E1098:')
- call assert_fails("call reduce([1, 2], 'Xdoes_not_exist')", 'E121:')
+ call assert_fails("call reduce([1, 2], 'Xdoes_not_exist')", 'E117:')
call assert_fails("echo reduce(0z01, { acc, val -> 2 * acc + val }, '')", 'E1210:')
" call assert_fails("vim9 reduce(0, (acc, val) => (acc .. val), '')", 'E1252:')