mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
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)
This commit is contained in:
committed by
Bram Moolenaar
parent
4ce1bda869
commit
f9dc278946
@@ -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
|
||||
|
Reference in New Issue
Block a user