Mercurial > vim
diff src/testdir/test_viminfo.vim @ 9915:4da1a3879100 v7.4.2231
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 20 18:36:54 2016 +0200
patch 7.4.2231
Problem: ":oldfiles" output is a very long list.
Solution: Add a pattern argument. (Coot, closes https://github.com/vim/vim/issues/575)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 20 Aug 2016 18:45:05 +0200 |
parents | 42adbf172ecd |
children | e975914c17e9 |
line wrap: on
line diff
--- a/src/testdir/test_viminfo.vim +++ b/src/testdir/test_viminfo.vim @@ -455,3 +455,28 @@ func Test_viminfo_file_mark_tabclose() call delete('Xviminfo') silent! bwipe Xtestfileintab endfunc + +func Test_oldfiles() + let v:oldfiles = [] + let lines = [ + \ '# comment line', + \ '*encoding=utf-8', + \ '', + \ "> /tmp/file_one.txt", + \ "\t\"\t11\t0", + \ "", + \ "> /tmp/file_two.txt", + \ "\t\"\t11\t0", + \ "", + \ "> /tmp/another.txt", + \ "\t\"\t11\t0", + \ "", + \ ] + call writefile(lines, 'Xviminfo') + rviminfo! Xviminfo + call delete('Xviminfo') + + call assert_equal(['1: /tmp/file_one.txt', '2: /tmp/file_two.txt', '3: /tmp/another.txt'], filter(split(execute('oldfile'), "\n"), {i, v -> v =~ '/tmp/'})) + call assert_equal(['1: /tmp/file_one.txt', '2: /tmp/file_two.txt'], filter(split(execute('oldfile file_'), "\n"), {i, v -> v =~ '/tmp/'})) + call assert_equal(['3: /tmp/another.txt'], filter(split(execute('oldfile /another/'), "\n"), {i, v -> v =~ '/tmp/'})) +endfunc