Mercurial > vim
annotate src/testdir/test_getcwd.vim @ 20490:1ee7baa5173b v8.2.0799
patch 8.2.0799: build fails if snprintf is not available
Commit: https://github.com/vim/vim/commit/74c69636563310d1e941fec695ff2d74518fe743
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 19 21:43:47 2020 +0200
patch 8.2.0799: build fails if snprintf is not available
Problem: Build fails if snprintf is not available.
Solution: Use vim_snprintf().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 19 May 2020 21:45:03 +0200 |
parents | e373843e2980 |
children | 08940efa6b4e |
rev | line source |
---|---|
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
1 func GetCwdInfo(win, tab) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
2 let tab_changed = 0 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
3 let mod = ":t" |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
4 if a:tab > 0 && a:tab != tabpagenr() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
5 let tab_changed = 1 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
6 exec "tabnext " . a:tab |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
7 endif |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
8 let bufname = fnamemodify(bufname(winbufnr(a:win)), mod) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
9 if tab_changed |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
10 tabprevious |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
11 endif |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
12 if a:win == 0 && a:tab == 0 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
13 let dirname = fnamemodify(getcwd(), mod) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
14 let lflag = haslocaldir() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
15 elseif a:tab == 0 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
16 let dirname = fnamemodify(getcwd(a:win), mod) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
17 let lflag = haslocaldir(a:win) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
18 else |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
19 let dirname = fnamemodify(getcwd(a:win, a:tab), mod) |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
16427
diff
changeset
|
20 let lflag = a:win->haslocaldir(a:tab) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
21 endif |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
22 return bufname . ' ' . dirname . ' ' . lflag |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
23 endfunc |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " Do all test in a separate window to avoid E211 when we recursively |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 " delete the Xtopdir directory during cleanup |
20003
e373843e2980
patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
27 func SetUp() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
28 set visualbell |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
29 set nocp viminfo+=nviminfo |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
31 " On windows a swapfile in Xtopdir prevents it from being cleaned up. |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
32 set noswapfile |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
34 " On windows a stale "Xtopdir" directory may exist, remove it so that |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
35 " we start from a clean state. |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
36 call delete("Xtopdir", "rf") |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
37 new |
17930
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
38 eval 'Xtopdir'->mkdir() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
39 cd Xtopdir |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
40 let g:topdir = getcwd() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
41 call mkdir('Xdir1') |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
42 call mkdir('Xdir2') |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
43 call mkdir('Xdir3') |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 endfunction |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 let g:cwd=getcwd() |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 function TearDown() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
48 q |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17930
diff
changeset
|
49 call chdir(g:cwd) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
50 call delete("Xtopdir", "rf") |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 endfunction |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 function Test_GetCwd() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
54 new a |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
55 new b |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
56 new c |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
57 3wincmd w |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
58 lcd Xdir1 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
59 call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
60 call assert_equal(g:topdir, getcwd(-1)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
61 wincmd W |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
62 call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
63 call assert_equal(g:topdir, getcwd(-1)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
64 wincmd W |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
65 lcd Xdir3 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
66 call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
67 call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
68 call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
69 call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
70 call assert_equal(g:topdir, getcwd(-1)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
71 wincmd W |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
72 call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
73 call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
74 call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
75 call assert_equal(g:topdir, getcwd(-1)) |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
77 tabnew x |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
78 new y |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
79 new z |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
80 3wincmd w |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
81 call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
82 call assert_equal(g:topdir, getcwd(-1)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
83 wincmd W |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
84 lcd Xdir2 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
85 call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
86 call assert_equal(g:topdir, getcwd(-1)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
87 wincmd W |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
88 lcd Xdir3 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
89 call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
90 call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
91 call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
92 call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
93 call assert_equal(g:topdir, getcwd(-1)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
94 let tp_nr = tabpagenr() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
95 tabrewind |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
96 call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
97 call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
98 call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
99 call assert_equal(g:topdir, getcwd(-1)) |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
100 " Non existing windows and tab pages |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
101 call assert_equal('', getcwd(100)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
102 call assert_equal(0, haslocaldir(100)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
103 call assert_equal('', getcwd(10, 1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
104 call assert_equal(0, haslocaldir(10, 1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
105 call assert_equal('', getcwd(1, 5)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
106 call assert_equal(0, haslocaldir(1, 5)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
107 call assert_fails('call getcwd([])', 'E745:') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
108 call assert_fails('call getcwd(1, [])', 'E745:') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
109 call assert_fails('call haslocaldir([])', 'E745:') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
110 call assert_fails('call haslocaldir(1, [])', 'E745:') |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 endfunc |
14834
ae62baca938c
patch 8.1.0429: no test for :lcd with 'shellslash'
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
112 |
ae62baca938c
patch 8.1.0429: no test for :lcd with 'shellslash'
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
113 function Test_GetCwd_lcd_shellslash() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
114 new |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
115 let root = fnamemodify('/', ':p') |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
116 exe 'lcd '.root |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
117 let cwd = getcwd() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
118 if !exists('+shellslash') || &shellslash |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
119 call assert_equal(cwd[-1:], '/') |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
120 else |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
121 call assert_equal(cwd[-1:], '\') |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
122 endif |
14834
ae62baca938c
patch 8.1.0429: no test for :lcd with 'shellslash'
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
123 endfunc |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
124 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
125 " Test for :tcd |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
126 function Test_Tab_Local_Cwd() |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
127 enew | only | tabonly |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
128 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
129 call mkdir('Xtabdir1') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
130 call mkdir('Xtabdir2') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
131 call mkdir('Xwindir1') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
132 call mkdir('Xwindir2') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
133 call mkdir('Xwindir3') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
134 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
135 " Create three tabpages with three windows each |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
136 edit a |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
137 botright new b |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
138 botright new c |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
139 tabnew m |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
140 botright new n |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
141 botright new o |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
142 tabnew x |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
143 botright new y |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
144 botright new z |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
145 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
146 " Setup different directories for the tab pages and windows |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
147 tabrewind |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
148 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
149 lcd Xwindir1 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
150 tabnext |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
151 tcd Xtabdir1 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
152 2wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
153 lcd ../Xwindir2 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
154 tabnext |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
155 tcd Xtabdir2 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
156 3wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
157 lcd ../Xwindir3 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
158 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
159 " Check the directories of various windows |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
160 call assert_equal("a Xwindir1 1", GetCwdInfo(1, 1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
161 call assert_equal("b Xtopdir 0", GetCwdInfo(2, 1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
162 call assert_equal("c Xtopdir 0", GetCwdInfo(3, 1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
163 call assert_equal("m Xtabdir1 2", GetCwdInfo(1, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
164 call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
165 call assert_equal("o Xtabdir1 2", GetCwdInfo(3, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
166 call assert_equal("x Xtabdir2 2", GetCwdInfo(1, 3)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
167 call assert_equal("y Xtabdir2 2", GetCwdInfo(2, 3)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
168 call assert_equal("z Xwindir3 1", GetCwdInfo(3, 3)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
169 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
170 " Check the tabpage directories |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
171 call assert_equal('Xtopdir', fnamemodify(getcwd(-1, 1), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
172 call assert_equal('Xtabdir1', fnamemodify(getcwd(-1, 2), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
173 call assert_equal('Xtabdir2', fnamemodify(getcwd(-1, 3), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
174 call assert_equal('', fnamemodify(getcwd(-1, 4), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
175 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
176 " Jump to different windows in the tab pages and check the current directory |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
177 tabrewind | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
178 call assert_equal('Xwindir1', fnamemodify(getcwd(), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
179 call assert_equal('Xwindir1', fnamemodify(getcwd(0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
180 call assert_equal('Xwindir1', fnamemodify(getcwd(0, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
181 call assert_true(haslocaldir(0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
182 call assert_equal(0, haslocaldir(-1, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
183 call assert_equal('Xtopdir', fnamemodify(getcwd(-1, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
184 call assert_equal(g:topdir, getcwd(-1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
185 2wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
186 call assert_equal('Xtopdir', fnamemodify(getcwd(), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
187 call assert_equal('Xtopdir', fnamemodify(getcwd(0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
188 call assert_equal('Xtopdir', fnamemodify(getcwd(0, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
189 call assert_false(haslocaldir(0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
190 call assert_equal(0, haslocaldir(-1, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
191 call assert_equal('Xtopdir', fnamemodify(getcwd(-1, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
192 call assert_equal(g:topdir, getcwd(-1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
193 tabnext | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
194 call assert_equal('Xtabdir1', fnamemodify(getcwd(), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
195 call assert_equal('Xtabdir1', fnamemodify(getcwd(0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
196 call assert_equal('Xtabdir1', fnamemodify(getcwd(0, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
197 call assert_true(haslocaldir(0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
198 call assert_equal(2, haslocaldir(-1, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
199 call assert_equal('Xtabdir1', fnamemodify(getcwd(-1, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
200 call assert_equal(g:topdir, getcwd(-1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
201 2wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
202 call assert_equal('Xwindir2', fnamemodify(getcwd(), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
203 call assert_equal('Xwindir2', fnamemodify(getcwd(0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
204 call assert_equal('Xwindir2', fnamemodify(getcwd(0, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
205 call assert_true(haslocaldir(0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
206 call assert_equal(2, haslocaldir(-1, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
207 call assert_equal('Xtabdir1', fnamemodify(getcwd(-1, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
208 call assert_equal(g:topdir, getcwd(-1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
209 tabnext | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
210 call assert_equal('Xtabdir2', fnamemodify(getcwd(), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
211 call assert_equal('Xtabdir2', fnamemodify(getcwd(0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
212 call assert_equal('Xtabdir2', fnamemodify(getcwd(0, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
213 call assert_true(haslocaldir(0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
214 call assert_equal(2, haslocaldir(-1, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
215 call assert_equal('Xtabdir2', fnamemodify(getcwd(-1, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
216 call assert_equal(g:topdir, getcwd(-1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
217 3wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
218 call assert_equal('Xwindir3', fnamemodify(getcwd(), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
219 call assert_equal('Xwindir3', fnamemodify(getcwd(0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
220 call assert_equal('Xwindir3', fnamemodify(getcwd(0, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
221 call assert_true(haslocaldir(0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
222 call assert_equal(2, haslocaldir(-1, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
223 call assert_equal('Xtabdir2', fnamemodify(getcwd(-1, 0), ':t')) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
224 call assert_equal(g:topdir, getcwd(-1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
225 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
226 " A new tab page should inherit the directory of the current tab page |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
227 tabrewind | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
228 tabnew g |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
229 call assert_equal("g Xwindir1 1", GetCwdInfo(0, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
230 tabclose | tabrewind |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
231 2wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
232 tabnew h |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
233 call assert_equal("h Xtopdir 0", GetCwdInfo(0, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
234 tabclose |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
235 tabnext 2 | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
236 tabnew j |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
237 call assert_equal("j Xtabdir1 2", GetCwdInfo(0, 0)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
238 tabclose |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
239 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
240 " Change the global directory for the first tab page |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
241 tabrewind | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
242 cd ../Xdir1 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
243 call assert_equal("a Xdir1 0", GetCwdInfo(1, 1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
244 call assert_equal("b Xdir1 0", GetCwdInfo(2, 1)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
245 call assert_equal("m Xtabdir1 2", GetCwdInfo(1, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
246 call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
247 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
248 " Change the global directory for the second tab page |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
249 tabnext | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
250 cd ../Xdir3 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
251 call assert_equal("m Xdir3 0", GetCwdInfo(1, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
252 call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
253 call assert_equal("o Xdir3 0", GetCwdInfo(3, 2)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
254 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
255 " Change the tab-local directory for the third tab page |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
256 tabnext | 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
257 cd ../Xdir1 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
258 call assert_equal("x Xdir1 0", GetCwdInfo(1, 3)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
259 call assert_equal("y Xdir1 0", GetCwdInfo(2, 3)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
260 call assert_equal("z Xwindir3 1", GetCwdInfo(3, 3)) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
261 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
262 enew | only | tabonly |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
263 new |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
264 endfunc |