Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 24128:fcbb1d4df15b v8.2.2605
patch 8.2.2605: Vim9: string index and slice does not include composing chars
Commit: https://github.com/vim/vim/commit/0289a093a4d65c6280a3be118d1d3696d1aa74da
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 14 18:40:19 2021 +0100
patch 8.2.2605: Vim9: string index and slice does not include composing chars
Problem: Vim9: string index and slice does not include composing chars.
Solution: Include composing characters. (issue https://github.com/vim/vim/issues/6563)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 14 Mar 2021 18:45:03 +0100 |
parents | 23c692a4bc36 |
children | 93e69703a290 |
comparison
equal
deleted
inserted
replaced
24127:8c03eefca0c1 | 24128:fcbb1d4df15b |
---|---|
2365 assert_equal('cdef', g:teststring[-4 :]) | 2365 assert_equal('cdef', g:teststring[-4 :]) |
2366 assert_equal('abcdef', g:teststring[-9 :]) | 2366 assert_equal('abcdef', g:teststring[-9 :]) |
2367 assert_equal('abcd', g:teststring[: -3]) | 2367 assert_equal('abcd', g:teststring[: -3]) |
2368 assert_equal('', g:teststring[: -9]) | 2368 assert_equal('', g:teststring[: -9]) |
2369 | 2369 |
2370 # composing characters are included | |
2371 g:teststring = 'àéû' | |
2372 assert_equal('à', g:teststring[0]) | |
2373 assert_equal('é', g:teststring[1]) | |
2374 assert_equal('û', g:teststring[2]) | |
2375 assert_equal('', g:teststring[3]) | |
2376 assert_equal('', g:teststring[4]) | |
2377 | |
2378 assert_equal('û', g:teststring[-1]) | |
2379 assert_equal('é', g:teststring[-2]) | |
2380 assert_equal('à', g:teststring[-3]) | |
2381 assert_equal('', g:teststring[-4]) | |
2382 assert_equal('', g:teststring[-5]) | |
2383 | |
2384 assert_equal('à', g:teststring[0 : 0]) | |
2385 assert_equal('é', g:teststring[1 : 1]) | |
2386 assert_equal('àé', g:teststring[0 : 1]) | |
2387 assert_equal('àéû', g:teststring[0 : -1]) | |
2388 assert_equal('àé', g:teststring[0 : -2]) | |
2389 assert_equal('à', g:teststring[0 : -3]) | |
2390 assert_equal('', g:teststring[0 : -4]) | |
2391 assert_equal('', g:teststring[0 : -5]) | |
2392 assert_equal('àéû', g:teststring[ : ]) | |
2393 assert_equal('àéû', g:teststring[0 : ]) | |
2394 assert_equal('éû', g:teststring[1 : ]) | |
2395 assert_equal('û', g:teststring[2 : ]) | |
2396 assert_equal('', g:teststring[3 : ]) | |
2397 assert_equal('', g:teststring[4 : ]) | |
2398 | |
2370 # blob index cannot be out of range | 2399 # blob index cannot be out of range |
2371 g:testblob = 0z01ab | 2400 g:testblob = 0z01ab |
2372 assert_equal(0x01, g:testblob[0]) | 2401 assert_equal(0x01, g:testblob[0]) |
2373 assert_equal(0xab, g:testblob[1]) | 2402 assert_equal(0xab, g:testblob[1]) |
2374 assert_equal(0xab, g:testblob[-1]) | 2403 assert_equal(0xab, g:testblob[-1]) |