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
|
Tests for tab pages
STARTTEST
:so small.vim
:" Simple test for opening and closing a tab page
:tabnew
:let nr = tabpagenr()
:q
:call append(line('$'), 'tab page ' . nr)
:unlet nr
:"
:" Open three tab pages and use ":tabdo"
:0tabnew
:1tabnew
:888tabnew
:tabdo call append(line('$'), 'this is tab page ' . tabpagenr())
:tabclose! 2
:tabrewind
:let line1 = getline('$')
:undo
:q
:tablast
:let line2 = getline('$')
:q!
:call append(line('$'), line1)
:call append(line('$'), line2)
:unlet line1 line2
:"
:" Test for settabvar() and gettabvar() functions. Open a new tab page and
:" set 3 variables to a number, string and a list. Verify that the variables
:" are correctly set.
:tabnew
:tabfirst
:call settabvar(2, 'val_num', 100)
:call settabvar(2, 'val_str', 'SetTabVar test')
:call settabvar(2, 'val_list', ['red', 'blue', 'green'])
:"
:let test_status = 'gettabvar: fail'
:if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test') && gettabvar(2, 'val_list') == ['red', 'blue', 'green'])
: let test_status = 'gettabvar: pass'
:endif
:call append(line('$'), test_status)
:"
:tabnext 2
:let test_status = 'settabvar: fail'
:if t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green']
: let test_status = 'settabvar: pass'
:endif
:tabclose
:call append(line('$'), test_status)
:"
:"
:" Test for ":tab drop exist-file" to keep current window.
:sp test1
:tab drop test1
:let test_status = 'tab drop 1: fail'
:if tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1
: let test_status = 'tab drop 1: pass'
:endif
:close
:call append(line('$'), test_status)
:"
:"
:" Test for ":tab drop new-file" to keep current window of tabpage 1.
:split
:tab drop newfile
:let test_status = 'tab drop 2: fail'
:if tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1
: let test_status = 'tab drop 2: pass'
:endif
:tabclose
:q
:call append(line('$'), test_status)
:"
:"
:" Test for ":tab drop multi-opend-file" to keep current tabpage and window.
:new test1
:tabnew
:new test1
:tab drop test1
:let test_status = 'tab drop 3: fail'
:if tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1
: let test_status = 'tab drop 3: pass'
:endif
:tabclose
:q
:call append(line('$'), test_status)
:"
:"
:/^Results/,$w! test.out
:qa!
ENDTEST
Results:
|