Mercurial > vim
diff src/testdir/test_functions.vim @ 32417:3c2c1cb61004 v9.0.1540
patch 9.0.1540: reverse() on string doesn't work in compiled function
Commit: https://github.com/vim/vim/commit/f9dc278946d52235a0025fd347bd9ff571258470
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Thu May 11 15:02:56 2023 +0100
patch 9.0.1540: reverse() on string doesn't work in compiled function
Problem: reverse() on string doesn't work in compiled function.
Solution: Accept string in argument type check. (Yegappan Lakshmanan,
closes #12377)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 11 May 2023 16:15:08 +0200 |
parents | 49a13ac4a1b1 |
children | d6055989fa27 |
line wrap: on
line diff
--- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -3475,13 +3475,16 @@ endfunc " Test for the reverse() function with a string func Test_string_reverse() - call assert_equal('', reverse(test_null_string())) - for [s1, s2] in [['', ''], ['a', 'a'], ['ab', 'ba'], ['abc', 'cba'], - \ ['abcd', 'dcba'], ['«-«-»-»', '»-»-«-«'], - \ ['🇦', '🇦'], ['🇦🇧', '🇧🇦'], ['🇦🇧🇨', '🇨🇧🇦'], - \ ['🇦«🇧-🇨»🇩', '🇩»🇨-🇧«🇦']] - call assert_equal(s2, reverse(s1)) - endfor + let lines =<< trim END + call assert_equal('', reverse(test_null_string())) + for [s1, s2] in [['', ''], ['a', 'a'], ['ab', 'ba'], ['abc', 'cba'], + \ ['abcd', 'dcba'], ['«-«-»-»', '»-»-«-«'], + \ ['🇦', '🇦'], ['🇦🇧', '🇧🇦'], ['🇦🇧🇨', '🇨🇧🇦'], + \ ['🇦«🇧-🇨»🇩', '🇩»🇨-🇧«🇦']] + call assert_equal(s2, reverse(s1)) + endfor + END + call v9.CheckLegacyAndVim9Success(lines) " test in latin1 encoding let save_enc = &encoding