summaryrefslogtreecommitdiff
path: root/src/testdir/test_viminfo.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-23 22:01:26 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-23 22:01:26 +0100
commit8e6be34338f13a6a625f19bcef82019c9adc65f2 (patch)
treee0dae3d62557da389976a5bc9c807ed9f417f344 /src/testdir/test_viminfo.vim
parent142f23544c7045b22e56fa6ee35808aceb6342f2 (diff)
downloadvim-git-8e6be34338f13a6a625f19bcef82019c9adc65f2.tar.gz
patch 8.2.2039: viminfo is not written when creating a new filev8.2.2039
Problem: Viminfo is not written when creating a new file. Solution: Set "b_marks_read" in the new buffer. (Christian Brabandt, closes #7350)
Diffstat (limited to 'src/testdir/test_viminfo.vim')
-rw-r--r--src/testdir/test_viminfo.vim30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim
index bc8afa0e1..20d90740b 100644
--- a/src/testdir/test_viminfo.vim
+++ b/src/testdir/test_viminfo.vim
@@ -1,6 +1,8 @@
" Test for reading and writing .viminfo
source check.vim
+source term_util.vim
+source shared.vim
function Test_viminfo_read_and_write()
" First clear 'history', so that "hislen" is zero. Then set it again,
@@ -879,4 +881,32 @@ func Test_viminfo_option_error()
call assert_fails('set viminfo=%10', 'E528:')
endfunc
+func Test_viminfo_oldfiles_newfile()
+ CheckRunVimInTerminal
+
+ let save_viminfo = &viminfo
+ let save_viminfofile = &viminfofile
+ set viminfo&vim
+ let v:oldfiles = []
+ let commands =<< trim [CODE]
+ set viminfofile=Xviminfofile
+ set viminfo&vim
+ w! Xnew-file.txt
+ qall
+ [CODE]
+ call writefile(commands, 'Xviminfotest')
+ let buf = RunVimInTerminal('-S Xviminfotest', #{wait_for_ruler: 0})
+ call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
+
+ let &viminfofile = 'Xviminfofile'
+ rviminfo! Xviminfofile
+ call assert_match('Xnew-file.txt$', v:oldfiles[0])
+ call assert_equal(1, len(v:oldfiles))
+ call delete('Xviminfofile')
+ call delete('Xviminfotest')
+ call delete('Xnew-file.txt')
+ let &viminfo = save_viminfo
+ let &viminfofile = save_viminfofile
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab