comparison 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
comparison
equal deleted inserted replaced
32416:06997bf5e6a8 32417:3c2c1cb61004
3473 call StopVimInTerminal(buf) 3473 call StopVimInTerminal(buf)
3474 endfunc 3474 endfunc
3475 3475
3476 " Test for the reverse() function with a string 3476 " Test for the reverse() function with a string
3477 func Test_string_reverse() 3477 func Test_string_reverse()
3478 call assert_equal('', reverse(test_null_string())) 3478 let lines =<< trim END
3479 for [s1, s2] in [['', ''], ['a', 'a'], ['ab', 'ba'], ['abc', 'cba'], 3479 call assert_equal('', reverse(test_null_string()))
3480 \ ['abcd', 'dcba'], ['«-«-»-»', '»-»-«-«'], 3480 for [s1, s2] in [['', ''], ['a', 'a'], ['ab', 'ba'], ['abc', 'cba'],
3481 \ ['🇦', '🇦'], ['🇦🇧', '🇧🇦'], ['🇦🇧🇨', '🇨🇧🇦'], 3481 \ ['abcd', 'dcba'], ['«-«-»-»', '»-»-«-«'],
3482 \ ['🇦«🇧-🇨»🇩', '🇩»🇨-🇧«🇦']] 3482 \ ['🇦', '🇦'], ['🇦🇧', '🇧🇦'], ['🇦🇧🇨', '🇨🇧🇦'],
3483 call assert_equal(s2, reverse(s1)) 3483 \ ['🇦«🇧-🇨»🇩', '🇩»🇨-🇧«🇦']]
3484 endfor 3484 call assert_equal(s2, reverse(s1))
3485 endfor
3486 END
3487 call v9.CheckLegacyAndVim9Success(lines)
3485 3488
3486 " test in latin1 encoding 3489 " test in latin1 encoding
3487 let save_enc = &encoding 3490 let save_enc = &encoding
3488 set encoding=latin1 3491 set encoding=latin1
3489 call assert_equal('dcba', reverse('abcd')) 3492 call assert_equal('dcba', reverse('abcd'))