diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-01-18 23:29:01 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-01-18 23:29:01 +0100 |
commit | b20e334859334be35de4b295023a2b49bdabbfa9 (patch) | |
tree | adc41d9170de34857be2de9628d10174d1501766 /src/testdir/test_viminfo.vim | |
parent | 61ff4dd6a4d47bd32383fe28087be2b37dec53f4 (diff) | |
download | vim-git-b20e334859334be35de4b295023a2b49bdabbfa9.tar.gz |
patch 7.4.1131v7.4.1131
Problem: New lines in the viminfo file are dropped.
Solution: Copy lines starting with "|". Fix that when using :rviminfo in a
function global variables were restored as function-local
variables.
Diffstat (limited to 'src/testdir/test_viminfo.vim')
-rw-r--r-- | src/testdir/test_viminfo.vim | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim new file mode 100644 index 000000000..3efe75e82 --- /dev/null +++ b/src/testdir/test_viminfo.vim @@ -0,0 +1,50 @@ +" Test for reading and writing .viminfo + +function Test_read_and_write() + let lines = [ + \ '# comment line', + \ '*encoding=utf-8', + \ '~MSle0~/asdf', + \ '|copied as-is', + \ '|and one more', + \ ] + call writefile(lines, 'Xviminfo') + rviminfo Xviminfo + call assert_equal('asdf', @/) + + wviminfo Xviminfo + let lines = readfile('Xviminfo') + let done = 0 + for line in lines + if line[0] == '|' + if done == 0 + call assert_equal('|copied as-is', line) + elseif done == 1 + call assert_equal('|and one more', line) + endif + let done += 1 + endif + endfor + call assert_equal(2, done) + + call delete('Xviminfo') +endfunc + +func Test_global_vars() + let test_dict = {'foo': 1, 'bar': 0, 'longvarible': 1000} + let g:MY_GLOBAL_DICT = test_dict + " store a really long list, so line wrapping will occur in viminfo file + let test_list = range(1,100) + let g:MY_GLOBAL_LIST = test_list + set viminfo='100,<50,s10,h,! + wv! Xviminfo + unlet g:MY_GLOBAL_DICT + unlet g:MY_GLOBAL_LIST + + rv! Xviminfo + call assert_equal(test_dict, g:MY_GLOBAL_DICT) + call assert_equal(test_list, g:MY_GLOBAL_LIST) + + call delete('Xviminfo') + set viminfo-=! +endfunc |