Mercurial > vim
annotate src/testdir/test62.in @ 3380:07fd030f89be v7.3.456
updated for version 7.3.456
Problem: ":tab drop file" has several problems, including moving the
current window and opening a new tab for a file that already has a
window.
Solution: Refactor ":tab drop" handling. (Hirohito Higashi)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 22 Feb 2012 19:13:08 +0100 |
parents | 6b4879aea261 |
children | 636e4db6e207 |
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 :" |
856 | 52 :" |
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) | |
88 :" | |
89 :" | |
856 | 90 :/^Results/,$w! test.out |
91 :qa! | |
92 ENDTEST | |
93 | |
94 Results: |