annotate src/testdir/test_excmd.vim @ 18463:18d7337b6837 v8.1.2225

patch 8.1.2225: the "last used" info of a buffer is under used Commit: https://github.com/vim/vim/commit/52410575be50d5c40bbe6380159df48cfc382ceb Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 27 05:12:45 2019 +0100 patch 8.1.2225: the "last used" info of a buffer is under used 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Oct 2019 05:15:06 +0100
parents a1437b8f2fac
children b8fd7364befd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17496
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for various Ex commands.
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 func Test_ex_delete()
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 new
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 call setline(1, ['a', 'b', 'c'])
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 2
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " :dl is :delete with the "l" flag, not :dlist
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 .dl
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 call assert_equal(['a', 'c'], getline(1, 2))
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 endfunc
17650
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
11
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
12 func Test_range_error()
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
13 call assert_fails(':.echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
14 call assert_fails(':$echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
15 call assert_fails(':1,2echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
16 call assert_fails(':+1echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
17 call assert_fails(':/1/echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
18 call assert_fails(':\/echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
19 normal vv
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
20 call assert_fails(":'<,'>echo 1", 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
21 endfunc
18463
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
22
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
23 func Test_buffers_lastused()
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
24 call test_settime(localtime() - 2000) " middle
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
25 edit bufa
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
26 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
27 call test_settime(localtime() - 10) " newest
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
28 edit bufb
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
29 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
30 call test_settime(1550010000) " oldest
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
31 edit bufc
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
32 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
33 call test_settime(0)
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
34 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
35
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
36 let ls = split(execute('buffers t', 'silent!'), '\n')
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
37 let bufs = ls->map({i,v->split(v, '"\s*')[1:2]})
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
38 call assert_equal(['bufb', 'bufa', 'bufc'], bufs[1:]->map({i,v->v[0]}))
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
39 call assert_match('1[0-3] seconds ago', bufs[1][1])
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
40 call assert_match('\d\d:\d\d:\d\d', bufs[2][1])
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
41 call assert_match('2019/02/1\d \d\d:\d\d:00', bufs[3][1])
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
42
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
43 bwipeout bufa
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
44 bwipeout bufb
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
45 bwipeout bufc
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
46 endfunc