diff src/testdir/test_viminfo.vim @ 20941:505d97ea54da v8.2.1022

patch 8.2.1022: various parts of code not covered by tests Commit: https://github.com/vim/vim/commit/845e0ee59430eac07e74b6cb92020e420d17953d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 20 16:05:32 2020 +0200 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 https://github.com/vim/vim/issues/6300)
author Bram Moolenaar <Bram@vim.org>
date Sat, 20 Jun 2020 16:15:04 +0200
parents 298ef749e5fb
children 6a4806e326dd
line wrap: on
line diff
--- a/src/testdir/test_viminfo.vim
+++ b/src/testdir/test_viminfo.vim
@@ -87,6 +87,28 @@ func Test_global_vars()
   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