Mercurial > vim
diff src/testdir/test_vim9_expr.vim @ 21823:b1f3d8a44ab6 v8.2.1461
patch 8.2.1461: Vim9: string indexes are counted in bytes
Commit: https://github.com/vim/vim/commit/e3c37d8ebf9dbbf210fde4a5fb28eb1f2a492a34
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 15 18:39:05 2020 +0200
patch 8.2.1461: Vim9: string indexes are counted in bytes
Problem: Vim9: string indexes are counted in bytes.
Solution: Use character indexes. (closes https://github.com/vim/vim/issues/6574)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 15 Aug 2020 18:45:04 +0200 |
parents | 0deb6f96a5a3 |
children | ccad66ac6c3e |
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -2075,12 +2075,28 @@ def Test_expr7_trailing() enddef def Test_expr7_subscript() - let text = 'abcdef' - assert_equal('', text[-1]) - assert_equal('a', text[0]) - assert_equal('e', text[4]) - assert_equal('f', text[5]) - assert_equal('', text[6]) + let lines =<< trim END + let text = 'abcdef' + assert_equal('', text[-1]) + assert_equal('a', text[0]) + assert_equal('e', text[4]) + assert_equal('f', text[5]) + assert_equal('', text[6]) + + text = 'ábçdëf' + assert_equal('', text[-999]) + assert_equal('', text[-1]) + assert_equal('á', text[0]) + assert_equal('b', text[1]) + assert_equal('ç', text[2]) + assert_equal('d', text[3]) + assert_equal('ë', text[4]) + assert_equal('f', text[5]) + assert_equal('', text[6]) + assert_equal('', text[999]) + END + CheckDefSuccess(lines) + CheckScriptSuccess(['vim9script'] + lines) enddef def Test_expr7_subscript_linebreak()