diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-27 05:12:45 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-27 05:12:45 +0100 |
commit | 52410575be50d5c40bbe6380159df48cfc382ceb (patch) | |
tree | f8a212edd951fa1df961da74870bc9c172dc0b01 /src/testdir/test_excmd.vim | |
parent | dfded98f87601b11271ee88392c821ceb6390eda (diff) | |
download | vim-git-52410575be50d5c40bbe6380159df48cfc382ceb.tar.gz |
patch 8.1.2225: the "last used" info of a buffer is under usedv8.1.2225
Problem: The "last used" info of a buffer is under used.
Solution: Add "lastused" to getbufinfo(). List buffers sorted by last-used
field. (Andi Massimino, closes #4722)
Diffstat (limited to 'src/testdir/test_excmd.vim')
-rw-r--r-- | src/testdir/test_excmd.vim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim index 509d78dfb..992fc3de0 100644 --- a/src/testdir/test_excmd.vim +++ b/src/testdir/test_excmd.vim @@ -19,3 +19,28 @@ func Test_range_error() normal vv call assert_fails(":'<,'>echo 1", 'E481:') endfunc + +func Test_buffers_lastused() + call test_settime(localtime() - 2000) " middle + edit bufa + enew + call test_settime(localtime() - 10) " newest + edit bufb + enew + call test_settime(1550010000) " oldest + edit bufc + enew + call test_settime(0) + enew + + let ls = split(execute('buffers t', 'silent!'), '\n') + let bufs = ls->map({i,v->split(v, '"\s*')[1:2]}) + call assert_equal(['bufb', 'bufa', 'bufc'], bufs[1:]->map({i,v->v[0]})) + call assert_match('1[0-3] seconds ago', bufs[1][1]) + call assert_match('\d\d:\d\d:\d\d', bufs[2][1]) + call assert_match('2019/02/1\d \d\d:\d\d:00', bufs[3][1]) + + bwipeout bufa + bwipeout bufb + bwipeout bufc +endfunc |