patch 8.2.1022: various parts of code not covered by tests
Problem: Various parts of code not covered by tests.
Solution: Add more tests. (Yegappan Lakshmanan, closes #6300)
diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim
index 8650598..1aadf59 100644
--- a/src/testdir/test_viminfo.vim
+++ b/src/testdir/test_viminfo.vim
@@ -87,6 +87,28 @@
call assert_equal(test_null, g:MY_GLOBAL_NULL)
call assert_equal(test_none, g:MY_GLOBAL_NONE)
+ " Test for invalid values for a blob, list, dict in a viminfo file
+ call writefile([
+ \ "!GLOB_BLOB_1\tBLO\t123",
+ \ "!GLOB_BLOB_2\tBLO\t012",
+ \ "!GLOB_BLOB_3\tBLO\t0z1x",
+ \ "!GLOB_BLOB_4\tBLO\t0z12 ab",
+ \ "!GLOB_LIST_1\tLIS\t1 2",
+ \ "!GLOB_DICT_1\tDIC\t1 2"], 'Xviminfo')
+ call assert_fails('rv! Xviminfo', 'E15:')
+ call assert_equal('123', g:GLOB_BLOB_1)
+ call assert_equal(1, type(g:GLOB_BLOB_1))
+ call assert_equal('012', g:GLOB_BLOB_2)
+ call assert_equal(1, type(g:GLOB_BLOB_2))
+ call assert_equal('0z1x', g:GLOB_BLOB_3)
+ call assert_equal(1, type(g:GLOB_BLOB_3))
+ call assert_equal('0z12 ab', g:GLOB_BLOB_4)
+ call assert_equal(1, type(g:GLOB_BLOB_4))
+ call assert_equal('1 2', g:GLOB_LIST_1)
+ call assert_equal(1, type(g:GLOB_LIST_1))
+ call assert_equal('1 2', g:GLOB_DICT_1)
+ call assert_equal(1, type(g:GLOB_DICT_1))
+
call delete('Xviminfo')
set viminfo-=!
endfunc