blob: b08f299fd023e995c38c95336542dac8845dd920 [file] [log] [blame]
Bram Moolenaarf73d3bc2016-04-11 21:55:15 +02001function! TablineWithCaughtError()
2 let s:func_in_tabline_called = 1
3 try
4 call eval('unknown expression')
5 catch
6 endtry
7 return ''
8endfunction
9
10function! TablineWithError()
11 let s:func_in_tabline_called = 1
12 call eval('unknown expression')
13 return ''
14endfunction
15
16function! Test_caught_error_in_tabline()
Bram Moolenaar73cd8fb2016-04-11 22:49:03 +020017 if has('gui')
18 set guioptions-=e
19 endif
Bram Moolenaarf73d3bc2016-04-11 21:55:15 +020020 let showtabline_save = &showtabline
21 set showtabline=2
22 let s:func_in_tabline_called = 0
23 let tabline = '%{TablineWithCaughtError()}'
24 let &tabline = tabline
25 redraw!
26 call assert_true(s:func_in_tabline_called)
27 call assert_equal(tabline, &tabline)
28 set tabline=
29 let &showtabline = showtabline_save
30endfunction
31
32function! Test_tabline_will_be_disabled_with_error()
Bram Moolenaar73cd8fb2016-04-11 22:49:03 +020033 if has('gui')
34 set guioptions-=e
35 endif
Bram Moolenaarf73d3bc2016-04-11 21:55:15 +020036 let showtabline_save = &showtabline
37 set showtabline=2
38 let s:func_in_tabline_called = 0
39 let tabline = '%{TablineWithError()}'
40 try
41 let &tabline = tabline
42 redraw!
43 catch
44 endtry
45 call assert_true(s:func_in_tabline_called)
46 call assert_equal('', &tabline)
47 set tabline=
48 let &showtabline = showtabline_save
49endfunction