From e11d61a3b1cdedf3144de697a2b38af62c3a78d8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 20 Aug 2016 18:36:54 +0200 Subject: patch 7.4.2231 Problem: ":oldfiles" output is a very long list. Solution: Add a pattern argument. (Coot, closes #575) --- src/testdir/test_viminfo.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/testdir/test_viminfo.vim') diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim index cbe481c59..d4ec6f78f 100644 --- 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 -- cgit v1.2.1