diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-19 18:33:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-19 18:33:44 +0800 |
commit | d9b094660944969b5160f2d22f0c2e8627e10d92 (patch) | |
tree | 9fd8d4342f77ed25e5abba5f697a827b3f3de38b /test | |
parent | d7ae9ae3e52362da33902c31ecccc79c49d3866e (diff) | |
parent | fcd729f22c658826024467801ae4ba0a92a8fabc (diff) | |
download | rneovim-d9b094660944969b5160f2d22f0c2e8627e10d92.tar.gz rneovim-d9b094660944969b5160f2d22f0c2e8627e10d92.tar.bz2 rneovim-d9b094660944969b5160f2d22f0c2e8627e10d92.zip |
Merge pull request #24787 from zeertzjq/vim-9.0.1515
vim-patch:9.0.{1515,1540,1738}
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_functions.vim | 20 | ||||
-rw-r--r-- | test/old/testdir/test_listdict.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_method.vim | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index c91e989233..4ad01c8531 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3148,4 +3148,24 @@ func Test_delfunc_while_listing() call StopVimInTerminal(buf) endfunc +" Test for the reverse() function with a string +func Test_string_reverse() + let lines =<< trim END + call assert_equal('', reverse(v:_null_string)) + for [s1, s2] in [['', ''], ['a', 'a'], ['ab', 'ba'], ['abc', 'cba'], + \ ['abcd', 'dcba'], ['«-«-»-»', '»-»-«-«'], + \ ['🇦', '🇦'], ['🇦🇧', '🇧🇦'], ['🇦🇧🇨', '🇨🇧🇦'], + \ ['🇦«🇧-🇨»🇩', '🇩»🇨-🇧«🇦']] + call assert_equal(s2, reverse(s1)) + endfor + END + call CheckLegacyAndVim9Success(lines) + + " test in latin1 encoding + let save_enc = &encoding + " set encoding=latin1 + call assert_equal('dcba', reverse('abcd')) + let &encoding = save_enc +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 354d987c79..0918e2cd98 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -894,7 +894,7 @@ func Test_reverse_sort_uniq() END call CheckLegacyAndVim9Success(lines) - call assert_fails('call reverse("")', 'E899:') + call assert_fails('call reverse({})', 'E1252:') call assert_fails('call uniq([1, 2], {x, y -> []})', 'E745:') call assert_fails("call sort([1, 2], function('min'), 1)", "E1206:") call assert_fails("call sort([1, 2], function('invalid_func'))", "E700:") diff --git a/test/old/testdir/test_method.vim b/test/old/testdir/test_method.vim index ca3b736429..88dbbd7bf4 100644 --- a/test/old/testdir/test_method.vim +++ b/test/old/testdir/test_method.vim @@ -63,7 +63,7 @@ func Test_dict_method() call assert_equal(2, d->remove("two")) let d.two = 2 call assert_fails('let x = d->repeat(2)', 'E731:') - call assert_fails('let x = d->reverse()', 'E899:') + call assert_fails('let x = d->reverse()', 'E1252:') call assert_fails('let x = d->sort()', 'E686:') call assert_equal("{'one': 1, 'two': 2, 'three': 3}", d->string()) call assert_equal(v:t_dict, d->type()) |