Mercurial > vim
comparison src/testdir/test_blob.vim @ 15589:44ea60ca593b v8.1.0802
patch 8.1.0802: negative index doesn't work for Blob
commit https://github.com/vim/vim/commit/a5be9b62480a6f338a72c01e57c9edd0bca8048b
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 24 12:31:44 2019 +0100
patch 8.1.0802: negative index doesn't work for Blob
Problem: Negative index doesn't work for Blob.
Solution: Make it work, add a test. (closes https://github.com/vim/vim/issues/3856)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 24 Jan 2019 12:45:05 +0100 |
parents | c2382f0d1279 |
children | a0eb2ff0f297 |
comparison
equal
deleted
inserted
replaced
15588:d1b7f02e6d29 | 15589:44ea60ca593b |
---|---|
93 call assert_equal(0x44, get(b, -1)) | 93 call assert_equal(0x44, get(b, -1)) |
94 call assert_equal(-1, get(b, 5)) | 94 call assert_equal(-1, get(b, 5)) |
95 call assert_equal(999, get(b, 5, 999)) | 95 call assert_equal(999, get(b, 5, 999)) |
96 call assert_equal(-1, get(b, -8)) | 96 call assert_equal(-1, get(b, -8)) |
97 call assert_equal(999, get(b, -8, 999)) | 97 call assert_equal(999, get(b, -8, 999)) |
98 | |
99 call assert_equal(0x00, b[0]) | |
100 call assert_equal(0x22, b[2]) | |
101 call assert_equal(0x44, b[4]) | |
102 call assert_equal(0x44, b[-1]) | |
103 call assert_fails('echo b[5]', 'E979:') | |
104 call assert_fails('echo b[-8]', 'E979:') | |
98 endfunc | 105 endfunc |
99 | 106 |
100 func Test_blob_to_string() | 107 func Test_blob_to_string() |
101 let b = 0z00112233445566778899aabbccdd | 108 let b = 0z00112233445566778899aabbccdd |
102 call assert_equal('0z00112233.44556677.8899AABB.CCDD', string(b)) | 109 call assert_equal('0z00112233.44556677.8899AABB.CCDD', string(b)) |