Mercurial > vim
diff src/testdir/test_vim9_expr.vim @ 21393:320581a133d9 v8.2.1247
patch 8.2.1247: Vim9: cannot index a character in a string
Commit: https://github.com/vim/vim/commit/bf9d8c3765a5255c0a0b577ca2e25d70a8bcb688
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 19 17:55:44 2020 +0200
patch 8.2.1247: Vim9: cannot index a character in a string
Problem: Vim9: cannot index a character in a string.
Solution: Add ISN_STRINDEX instruction. (closes https://github.com/vim/vim/issues/6478)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 Jul 2020 18:00:04 +0200 |
parents | 8d58cbb07a12 |
children | 5cb6e676defd |
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -1509,6 +1509,15 @@ def Test_expr7_trailing() assert_equal(123, d.key) 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]) +enddef + def Test_expr7_subscript_linebreak() let range = range( 3)