1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
let s:suite = themis#suite('onetab')
let s:assert = themis#helper('assert')
function! s:suite.before_each()
let g:lightline = {}
call lightline#init()
tabnew
tabonly
endfunction
function! s:suite.onetab()
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
endfunction
function! s:suite.tabnew()
tabnew
call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
endfunction
function! s:suite.tabnew_tabnew()
tabnew
tabnew
call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
call s:assert.equals(lightline#onetab(2, 0), '2 [No Name]')
call s:assert.equals(lightline#onetab(3, 1), '3 [No Name]')
endfunction
function! s:suite.modified()
call append(0, '')
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name] +')
undo
endfunction
function! s:suite.filename()
edit test
call s:assert.equals(lightline#onetab(1, 1), '1 test')
tabnew
bunload test
endfunction
function! s:suite.filename_modified()
edit test
call append(0, '')
call s:assert.equals(lightline#onetab(1, 1), '1 test +')
tabnew
bunload! test
endfunction
function! s:suite.active_inactive()
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'filename' ], 'inactive': [ 'filename' ] } }
call lightline#init()
edit test
call append(0, '')
call s:assert.equals(lightline#onetab(1, 1), '1 test')
call s:assert.equals(lightline#onetab(1, 0), 'test')
tabnew
bunload! test
endfunction
function! s:suite.tab_component()
let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component': { 'custom': 'custom' } }
call lightline#init()
call s:assert.equals(lightline#onetab(1, 1), 'custom')
call s:assert.equals(lightline#onetab(2, 1), 'custom')
endfunction
function! s:suite.tab_component_function()
function! Custom(n)
return 'custom: ' . a:n
endfunction
let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component_function': { 'custom': 'Custom' } }
call lightline#init()
call s:assert.equals(lightline#onetab(1, 1), 'custom: 1')
call s:assert.equals(lightline#onetab(2, 1), 'custom: 2')
delfunction Custom
endfunction
function! s:suite.tab_component_empty_middle()
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom', 'filename' ], 'inactive': [ 'tabnum', 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
call lightline#init()
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
endfunction
function! s:suite.tab_component_empty_left()
let g:lightline = { 'tab': { 'active': [ 'custom', 'filename' ], 'inactive': [ 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
call lightline#init()
call s:assert.equals(lightline#onetab(1, 1), '[No Name]')
call s:assert.equals(lightline#onetab(2, 1), '[No Name]')
endfunction
function! s:suite.tab_component_empty_middle()
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom' ], 'inactive': [ 'tabnum', 'custom', 'custom' ] }, 'tab_component': { 'custom': '' } }
call lightline#init()
call s:assert.equals(lightline#onetab(1, 1), '1')
call s:assert.equals(lightline#onetab(2, 1), '2')
endfunction
|