annotate src/testdir/test_statusline.vim @ 15062:3a94f7918980 v8.1.0542

patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account commit https://github.com/vim/vim/commit/f951416a8396a54bbbe21de1a8b16716428549f2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 22 03:08:29 2018 +0100 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account Problem: shiftwidth() does not take 'vartabstop' into account. Solution: Use the cursor position or a position explicitly passed. Also make >> and << work better with 'vartabstop'. (Christian Brabandt)
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Nov 2018 03:15:10 +0100
parents 185f8dbdcf26
children 97e15f5b0082
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
1 " Test 'statusline'
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
2 "
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
3 " Not tested yet:
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
4 " %a
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
5 " %N
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
6 " %T
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
7 " %X
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
8
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
9 source view_util.vim
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
10
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
11 func s:get_statusline()
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
12 return ScreenLines(&lines - 1, &columns)[0]
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
13 endfunc
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
14
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
15 func StatuslineWithCaughtError()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let s:func_in_statusline_called = 1
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 try
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call eval('unknown expression')
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 catch
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 endtry
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 return ''
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
22 endfunc
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
24 func StatuslineWithError()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 let s:func_in_statusline_called = 1
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call eval('unknown expression')
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 return ''
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
28 endfunc
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
30 " Function used to display syntax group.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
31 func SyntaxItem()
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
32 return synIDattr(synID(line("."),col("."),1),"name")
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
33 endfunc
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
34
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
35 func Test_caught_error_in_statusline()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 let s:func_in_statusline_called = 0
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 set laststatus=2
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 let statusline = '%{StatuslineWithCaughtError()}'
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 let &statusline = statusline
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 redrawstatus
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_true(s:func_in_statusline_called)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal(statusline, &statusline)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 set statusline=
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
44 endfunc
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
46 func Test_statusline_will_be_disabled_with_error()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 let s:func_in_statusline_called = 0
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 set laststatus=2
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 let statusline = '%{StatuslineWithError()}'
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 try
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let &statusline = statusline
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 redrawstatus
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 catch
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 endtry
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 call assert_true(s:func_in_statusline_called)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 call assert_equal('', &statusline)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 set statusline=
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
58 endfunc
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
59
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
60 func Test_statusline()
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
61 new Xstatusline
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
62 only
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
63 set laststatus=2
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
64 set splitbelow
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
65 call setline(1, range(1, 200))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
66
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
67 " %b: Value of character under cursor.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
68 " %B: As above, in hexadecimal.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
69 call cursor(180, 2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
70 set statusline=%b,%B
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
71 call assert_match('^56,38\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
72
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
73 " %o: Byte number in file of byte under cursor, first byte is 1.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
74 " %O: As above, in hexadecimal.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
75 set statusline=%o,%O
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
76 set fileformat=dos
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
77 call assert_match('^789,315\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
78 set fileformat=mac
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
79 call assert_match('^610,262\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
80 set fileformat=unix
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
81 call assert_match('^610,262\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
82 set fileformat&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
83
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
84 " %f: Path to the file in the buffer, as typed or relative to current dir.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
85 set statusline=%f
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
86 call assert_match('^Xstatusline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
87
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
88 " %F: Full path to the file in the buffer.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
89 set statusline=%F
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
90 call assert_match('/testdir/Xstatusline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
91
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
92 " %h: Help buffer flag, text is "[help]".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
93 " %H: Help buffer flag, text is ",HLP".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
94 set statusline=%h,%H
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
95 call assert_match('^,\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
96 help
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
97 call assert_match('^\[Help\],HLP\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
98 helpclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
99
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
100 " %k: Value of "b:keymap_name" or 'keymap'
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
101 " when :lmap mappings are being used: <keymap>"
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
102 set statusline=%k
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
103 if has('keymap')
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
104 set keymap=esperanto
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
105 call assert_match('^<Eo>\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
106 set keymap&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
107 else
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
108 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
109 endif
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
110
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
111 " %l: Line number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
112 " %L: Number of line in buffer.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
113 " %c: Column number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
114 set statusline=%l/%L,%c
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
115 call assert_match('^180/200,2\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
116
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
117 " %m: Modified flag, text is "[+]", "[-]" if 'modifiable' is off.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
118 " %M: Modified flag, text is ",+" or ",-".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
119 set statusline=%m%M
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
120 call assert_match('^\[+\],+\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
121 set nomodifiable
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
122 call assert_match('^\[+-\],+-\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
123 write
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
124 call assert_match('^\[-\],-\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
125 set modifiable&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
126 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
127
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
128 " %n: Buffer number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
129 set statusline=%n
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
130 call assert_match('^'.bufnr('%').'\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
131
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
132 " %p: Percentage through file in lines as in CTRL-G.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
133 " %P: Percentage through file of displayed window.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
134 set statusline=%p,%P
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
135 0
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
136 call assert_match('^0,Top\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
137 norm G
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
138 call assert_match('^100,Bot\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
139 180
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
140 " Don't check the exact percentage as it depends on the window size
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
141 call assert_match('^90,\(Top\|Bot\|\d\+%\)\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
142
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
143 " %q: "[Quickfix List]", "[Location List]" or empty.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
144 set statusline=%q
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
145 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
146 copen
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
147 call assert_match('^\[Quickfix List\]\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
148 cclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
149 lexpr getline(1, 2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
150 lopen
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
151 call assert_match('^\[Location List\]\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
152 lclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
153
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
154 " %r: Readonly flag, text is "[RO]".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
155 " %R: Readonly flag, text is ",RO".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
156 set statusline=%r,%R
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
157 call assert_match('^,\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
158 help
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
159 call assert_match('^\[RO\],RO\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
160 helpclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
161
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
162 " %t: File name (tail) of file in the buffer.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
163 set statusline=%t
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
164 call assert_match('^Xstatusline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
165
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
166 " %v: Virtual column number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
167 " %V: Virtual column number as -{num}. Not displayed if equal to 'c'.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
168 call cursor(180, 2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
169 set statusline=%v,%V
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
170 call assert_match('^2,\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
171 set virtualedit=all
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
172 norm 10|
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
173 call assert_match('^10,-10\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
174 set virtualedit&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
175
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
176 " %w: Preview window flag, text is "[Preview]".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
177 " %W: Preview window flag, text is ",PRV".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
178 set statusline=%w%W
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
179 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
180 pedit
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
181 wincmd j
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
182 call assert_match('^\[Preview\],PRV\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
183 pclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
184
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
185 " %y: Type of file in the buffer, e.g., "[vim]". See 'filetype'.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
186 " %Y: Type of file in the buffer, e.g., ",VIM". See 'filetype'.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
187 set statusline=%y\ %Y
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
188 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
189 setfiletype vim
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
190 call assert_match('^\[vim\] VIM\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
191
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
192 " %=: Separation point between left and right aligned items.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
193 set statusline=foo%=bar
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
194 call assert_match('^foo\s\+bar\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
195
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
196 " Test min/max width, leading zeroes, left/right justify.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
197 set statusline=%04B
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
198 call cursor(180, 2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
199 call assert_match('^0038\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
200 set statusline=#%4B#
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
201 call assert_match('^# 38#\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
202 set statusline=#%-4B#
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
203 call assert_match('^#38 #\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
204 set statusline=%.6f
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
205 call assert_match('^<sline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
206
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
207 " %<: Where to truncate.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
208 exe 'set statusline=a%<b' . repeat('c', 1000) . 'd'
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
209 call assert_match('^a<c*d$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
210 exe 'set statusline=a' . repeat('b', 1000) . '%<c'
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
211 call assert_match('^ab*>$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
212
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
213 "%{: Evaluate expression between '%{' and '}' and substitute result.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
214 syntax on
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
215 set statusline=%{SyntaxItem()}
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
216 call assert_match('^vimNumber\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
217 s/^/"/
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
218 call assert_match('^vimLineComment\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
219 syntax off
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
220
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
221 "%(: Start of item group.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
222 set statusline=ab%(cd%q%)de
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
223 call assert_match('^abde\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
224 copen
11525
14b6b79d685b patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents: 11075
diff changeset
225 call assert_match('^abcd\[Quickfix List]de\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
226 cclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
227
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
228 " %#: Set highlight group. The name must follow and then a # again.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
229 set statusline=ab%#Todo#cd%#Error#ef
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
230 call assert_match('^abcdef\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
231 let sa1=screenattr(&lines - 1, 1)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
232 let sa2=screenattr(&lines - 1, 3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
233 let sa3=screenattr(&lines - 1, 5)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
234 call assert_notequal(sa1, sa2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
235 call assert_notequal(sa1, sa3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
236 call assert_notequal(sa2, sa3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
237 call assert_equal(sa1, screenattr(&lines - 1, 2))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
238 call assert_equal(sa2, screenattr(&lines - 1, 4))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
239 call assert_equal(sa3, screenattr(&lines - 1, 6))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
240 call assert_equal(sa3, screenattr(&lines - 1, 7))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
241
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
242 " %*: Set highlight group to User{N}
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
243 set statusline=a%1*b%0*c
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
244 call assert_match('^abc\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
245 let sa1=screenattr(&lines - 1, 1)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
246 let sa2=screenattr(&lines - 1, 2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
247 let sa3=screenattr(&lines - 1, 3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
248 call assert_equal(sa1, sa3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
249 call assert_notequal(sa1, sa2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
250
12660
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
251 " An empty group that contains highlight changes
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
252 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
253 set statusline=ab%(cd%1*%{g:a}%*%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
254 call assert_match('^abde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
255 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
256 let sa2=screenattr(&lines - 1, 4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
257 call assert_equal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
258 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
259 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
260 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
261 let sa2=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
262 let sa3=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
263 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
264 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
265
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
266 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
267 set statusline=ab%1*%(cd%*%{g:a}%1*%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
268 call assert_match('^abde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
269 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
270 let sa2=screenattr(&lines - 1, 4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
271 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
272 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
273 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
274 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
275 let sa2=screenattr(&lines - 1, 3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
276 let sa3=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
277 let sa4=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
278 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
279 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
280 call assert_equal(sa2, sa4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
281
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
282 " An empty group that contains highlight changes and doesn't reset them
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
283 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
284 set statusline=ab%(cd%1*%{g:a}%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
285 call assert_match('^abcdde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
286 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
287 let sa2=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
288 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
289 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
290 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
291 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
292 let sa2=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
293 let sa3=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
294 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
295 call assert_equal(sa2, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
296
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
297 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
298 set statusline=ab%1*%(cd%*%{g:a}%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
299 call assert_match('^abcdde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
300 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
301 let sa2=screenattr(&lines - 1, 3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
302 let sa3=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
303 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
304 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
305 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
306 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
307 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
308 let sa2=screenattr(&lines - 1, 3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
309 let sa3=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
310 let sa4=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
311 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
312 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
313 call assert_equal(sa1, sa4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
314
12684
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
315 let g:a = ''
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
316 set statusline=%#Error#{%(\ %{g:a}\ %)}
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
317 call assert_match('^{}\s*$', s:get_statusline())
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
318 let g:a = 'X'
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
319 call assert_match('^{ X }\s*$', s:get_statusline())
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
320
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
321 " %%: a percent sign.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
322 set statusline=10%%
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
323 call assert_match('^10%\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
324
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
325 " %!: evaluated expression is used as the option value
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
326 set statusline=%!2*3+1
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
327 call assert_match('7\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
328
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
329 " Check statusline in current and non-current window
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
330 " with the 'fillchars' option.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
331 set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:-
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
332 vsplit
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
333 set statusline=x%=y
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
334 call assert_match('^x^\+y^x=\+y$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
335 set fillchars&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
336 close
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
337
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
338 %bw!
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
339 call delete('Xstatusline')
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
340 set statusline&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
341 set laststatus&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
342 set splitbelow&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
343 endfunc