Mercurial > vim
annotate src/testdir/test_statusline.vim @ 10049:efc8a434f38f v7.4.2296
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 31 20:33:27 2016 +0200
patch 7.4.2296
Problem: No tests for :undolist and "U" command.
Solution: Add tests. (Dominique Pelle)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 31 Aug 2016 20:45:05 +0200 |
parents | 470ea7526cc6 |
children | a8be0c7169b1 |
rev | line source |
---|---|
8847
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 function! StatuslineWithCaughtError() |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 let s:func_in_statusline_called = 1 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 try |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 call eval('unknown expression') |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 catch |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 endtry |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 return '' |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 endfunction |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 function! StatuslineWithError() |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 let s:func_in_statusline_called = 1 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call eval('unknown expression') |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 return '' |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endfunction |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 function! Test_caught_error_in_statusline() |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 let s:func_in_statusline_called = 0 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 set laststatus=2 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 let statusline = '%{StatuslineWithCaughtError()}' |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 let &statusline = statusline |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 redrawstatus |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 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
|
23 call assert_equal(statusline, &statusline) |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 set statusline= |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 endfunction |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 function! Test_statusline_will_be_disabled_with_error() |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 let s:func_in_statusline_called = 0 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 set laststatus=2 |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 let statusline = '%{StatuslineWithError()}' |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 try |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 let &statusline = statusline |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 redrawstatus |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 catch |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 endtry |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 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
|
37 call assert_equal('', &statusline) |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 set statusline= |
470ea7526cc6
commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 endfunction |