Mercurial > vim
diff src/testdir/test_blob.vim @ 15515:99a4cc4782ac v8.1.0765
patch 8.1.0765: string format of a Blob can't be parsed back
commit https://github.com/vim/vim/commit/4131fd5509b283e978e8c6161f09643b64719787
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 17 16:32:53 2019 +0100
patch 8.1.0765: string format of a Blob can't be parsed back
Problem: String format of a Blob can't be parsed back.
Solution: Use 0z format.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 17 Jan 2019 16:45:06 +0100 |
parents | f1c33409e908 |
children | 4af72c724093 |
line wrap: on
line diff
--- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -26,6 +26,12 @@ func Test_blob_create() call assert_fails('let b = 0z12345', 'E973:') call assert_equal(0z, test_null_blob()) + + let b = 0z001122.33445566.778899.aabbcc.dd + call assert_equal(0z00112233445566778899aabbccdd, b) + call assert_fails('let b = 0z1.1') + call assert_fails('let b = 0z.') + call assert_fails('let b = 0z001122.') endfunc " assignment to a blob @@ -91,10 +97,13 @@ func Test_blob_get() endfunc func Test_blob_to_string() - let b = 0zDEADBEEF - call assert_equal('[0xDE,0xAD,0xBE,0xEF]', string(b)) + let b = 0z00112233445566778899aabbccdd + call assert_equal('0z00112233.44556677.8899AABB.CCDD', string(b)) + call assert_equal(b, eval(string(b))) + call remove(b, 4, -1) + call assert_equal('0z00112233', string(b)) call remove(b, 0, 3) - call assert_equal('[]', string(b)) + call assert_equal('0z', string(b)) endfunc func Test_blob_compare()