Mercurial > vim
annotate src/testdir/test62.in @ 4323:f1eab4f77a6f v7.3.911
updated for version 7.3.911
Problem: Python: Access to Vim variables is not so easy.
Solution: Define vim.vars and vim.vvars. (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 24 Apr 2013 14:07:45 +0200 |
parents | e5b925ae56e3 |
children | c80838526eeb |
rev | line source |
---|---|
856 | 1 Tests for tab pages |
2 | |
3 STARTTEST | |
4 :so small.vim | |
5 :" Simple test for opening and closing a tab page | |
6 :tabnew | |
7 :let nr = tabpagenr() | |
8 :q | |
9 :call append(line('$'), 'tab page ' . nr) | |
1405 | 10 :unlet nr |
856 | 11 :" |
12 :" Open three tab pages and use ":tabdo" | |
13 :0tabnew | |
14 :1tabnew | |
15 :888tabnew | |
16 :tabdo call append(line('$'), 'this is tab page ' . tabpagenr()) | |
17 :tabclose! 2 | |
18 :tabrewind | |
19 :let line1 = getline('$') | |
20 :undo | |
21 :q | |
22 :tablast | |
23 :let line2 = getline('$') | |
24 :q! | |
25 :call append(line('$'), line1) | |
26 :call append(line('$'), line2) | |
1405 | 27 :unlet line1 line2 |
856 | 28 :" |
2240
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
29 :" Test for settabvar() and gettabvar() functions. Open a new tab page and |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
30 :" set 3 variables to a number, string and a list. Verify that the variables |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
31 :" are correctly set. |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
32 :tabnew |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
33 :tabfirst |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
34 :call settabvar(2, 'val_num', 100) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
35 :call settabvar(2, 'val_str', 'SetTabVar test') |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
36 :call settabvar(2, 'val_list', ['red', 'blue', 'green']) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
37 :" |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
38 :let test_status = 'gettabvar: fail' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
39 :if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test') && gettabvar(2, 'val_list') == ['red', 'blue', 'green']) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
40 : let test_status = 'gettabvar: pass' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
41 :endif |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
42 :call append(line('$'), test_status) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
43 :" |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
44 :tabnext 2 |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
45 :let test_status = 'settabvar: fail' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
46 :if t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green'] |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
47 : let test_status = 'settabvar: pass' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
48 :endif |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
49 :tabclose |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
50 :call append(line('$'), test_status) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
51 :" |
3408 | 52 :if has('gui') || has('clientserver') |
3380 | 53 :" Test for ":tab drop exist-file" to keep current window. |
54 :sp test1 | |
55 :tab drop test1 | |
56 :let test_status = 'tab drop 1: fail' | |
57 :if tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1 | |
58 : let test_status = 'tab drop 1: pass' | |
59 :endif | |
60 :close | |
61 :call append(line('$'), test_status) | |
62 :" | |
63 :" | |
64 :" Test for ":tab drop new-file" to keep current window of tabpage 1. | |
65 :split | |
66 :tab drop newfile | |
67 :let test_status = 'tab drop 2: fail' | |
68 :if tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1 | |
69 : let test_status = 'tab drop 2: pass' | |
70 :endif | |
71 :tabclose | |
72 :q | |
73 :call append(line('$'), test_status) | |
74 :" | |
75 :" | |
76 :" Test for ":tab drop multi-opend-file" to keep current tabpage and window. | |
77 :new test1 | |
78 :tabnew | |
79 :new test1 | |
80 :tab drop test1 | |
81 :let test_status = 'tab drop 3: fail' | |
82 :if tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1 | |
83 : let test_status = 'tab drop 3: pass' | |
84 :endif | |
85 :tabclose | |
86 :q | |
87 :call append(line('$'), test_status) | |
3408 | 88 :else |
89 :" :drop not supported | |
90 :call append(line('$'), 'tab drop 1: pass') | |
91 :call append(line('$'), 'tab drop 2: pass') | |
92 :call append(line('$'), 'tab drop 3: pass') | |
93 :endif | |
3380 | 94 :" |
95 :" | |
3662 | 96 :for i in range(9) | tabnew | endfor |
97 1gt | |
98 Go=tabpagenr() | |
99 :tabmove 5 | |
100 i=tabpagenr() | |
101 :tabmove -2 | |
102 i=tabpagenr() | |
103 :tabmove +4 | |
104 i=tabpagenr() | |
105 :tabmove | |
106 i=tabpagenr() | |
107 :tabmove -20 | |
108 i=tabpagenr() | |
109 :tabmove +20 | |
110 i=tabpagenr() | |
111 :3tabmove | |
112 i=tabpagenr() | |
113 :7tabmove 5 | |
114 i=tabpagenr() | |
115 :let a='No error caught.' | |
116 :try | |
117 :tabmove foo | |
118 :catch E474 | |
119 :let a='E474 caught.' | |
120 :endtry | |
121 i=a | |
122 :" | |
123 :" | |
856 | 124 :/^Results/,$w! test.out |
125 :qa! | |
126 ENDTEST | |
127 | |
128 Results: |