diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-11 20:26:34 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-11 20:26:34 +0200 |
commit | cfc3023cb6ce5aaec13f49bc4b821feb05e3fb03 (patch) | |
tree | da16e23aca547d7eb0cf4c4026415fad30d5b00f /src/testdir | |
parent | af8ea0d066d31cf3cd0a39c5c49ce0342728588d (diff) |
patch 8.2.2756: Vim9: blob index and slice not implemented yetv8.2.2756
Problem: Vim9: blob index and slice not implemented yet.
Solution: Implement blob index and slice.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_expr.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index 0e0e34e01e..456b42612e 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -1622,6 +1622,26 @@ def Test_expr7_blob() assert_equal(g:blob_empty, 0z) assert_equal(g:blob_one, 0z01) assert_equal(g:blob_long, 0z0102.0304) + + var testblob = 0z010203 + assert_equal(0x01, testblob[0]) + assert_equal(0x02, testblob[1]) + assert_equal(0x03, testblob[-1]) + assert_equal(0x02, testblob[-2]) + + assert_equal(0z01, testblob[0 : 0]) + assert_equal(0z0102, testblob[0 : 1]) + assert_equal(0z010203, testblob[0 : 2]) + assert_equal(0z010203, testblob[0 : ]) + assert_equal(0z0203, testblob[1 : ]) + assert_equal(0z0203, testblob[1 : 2]) + assert_equal(0z0203, testblob[1 : -1]) + assert_equal(0z03, testblob[-1 : -1]) + assert_equal(0z02, testblob[-2 : -2]) + + # blob slice accepts out of range + assert_equal(0z, testblob[3 : 3]) + assert_equal(0z, testblob[0 : -4]) END CheckDefAndScriptSuccess(lines) |