Mercurial > vim
annotate src/testdir/test_getcwd.vim @ 33776:9503dc55b5ed v9.0.2108
patch 9.0.2108: [security]: overflow with count for :s command
Commit: https://github.com/vim/vim/commit/ac63787734fda2e294e477af52b3bd601517fa78
Author: Christian Brabandt <cb@256bit.org>
Date: Tue Nov 14 20:45:48 2023 +0100
patch 9.0.2108: [security]: overflow with count for :s command
Problem: [security]: overflow with count for :s command
Solution: Abort the :s command if the count is too large
If the count after the :s command is larger than what fits into a
(signed) long variable, abort with e_value_too_large.
Adds a test with INT_MAX as count and verify it correctly fails.
It seems the return value on Windows using mingw compiler wraps around,
so the initial test using :s/./b/9999999999999999999999999990 doesn't
fail there, since the count is wrapping around several times and finally
is no longer larger than 2147483647. So let's just use 2147483647 in the
test, which hopefully will always cause a failure
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 16 Nov 2023 22:15:10 +0100 |
parents | d891115c0aea |
children |
rev | line source |
---|---|
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20003
diff
changeset
|
1 " Test for getcwd() |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20003
diff
changeset
|
2 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
3 func GetCwdInfo(win, tab) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
4 let tab_changed = 0 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
5 let mod = ":t" |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
6 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
|
7 let tab_changed = 1 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
8 exec "tabnext " . a:tab |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
9 endif |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
10 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
|
11 if tab_changed |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
12 tabprevious |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
13 endif |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
14 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
|
15 let dirname = fnamemodify(getcwd(), mod) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
16 let lflag = haslocaldir() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
17 elseif a:tab == 0 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
18 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
|
19 let lflag = haslocaldir(a:win) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
20 else |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
21 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
|
22 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
|
23 endif |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
24 return bufname . ' ' . dirname . ' ' . lflag |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
25 endfunc |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " 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
|
28 " 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
|
29 func SetUp() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
30 set visualbell |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
31 set nocp viminfo+=nviminfo |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
33 " 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
|
34 set noswapfile |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
36 " 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
|
37 " 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
|
38 call delete("Xtopdir", "rf") |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
39 new |
17930
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
40 eval 'Xtopdir'->mkdir() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
41 cd Xtopdir |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
42 let g:topdir = getcwd() |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
43 call mkdir('Xcwdir1') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
44 call mkdir('Xcwdir2') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
45 call mkdir('Xcwdir3') |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 endfunction |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 let g:cwd=getcwd() |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 function TearDown() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
50 q |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17930
diff
changeset
|
51 call chdir(g:cwd) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
52 call delete("Xtopdir", "rf") |
11651
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 endfunction |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 |
140d51d5b5c3
patch 8.0.0708: some tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 function Test_GetCwd() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
56 new a |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
57 new b |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
58 new c |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
59 3wincmd w |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
60 lcd Xcwdir1 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
61 call assert_equal("a Xcwdir1 1", GetCwdInfo(0, 0)) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
62 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
|
63 wincmd W |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
64 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
|
65 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
|
66 wincmd W |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
67 lcd Xcwdir3 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
68 call assert_equal("c Xcwdir3 1", GetCwdInfo(0, 0)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
69 call assert_equal("a Xcwdir1 1", GetCwdInfo(bufwinnr("a"), 0)) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
70 call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
71 call assert_equal("c Xcwdir3 1", GetCwdInfo(bufwinnr("c"), 0)) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
72 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
|
73 wincmd W |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
74 call assert_equal("a Xcwdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
75 call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
76 call assert_equal("c Xcwdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
77 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
|
78 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
79 tabnew x |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
80 new y |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
81 new z |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
82 3wincmd w |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
83 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
|
84 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
|
85 wincmd W |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
86 lcd Xcwdir2 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
87 call assert_equal("y Xcwdir2 1", GetCwdInfo(0, 0)) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
88 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
|
89 wincmd W |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
90 lcd Xcwdir3 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
91 call assert_equal("z Xcwdir3 1", GetCwdInfo(0, 0)) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
92 call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
93 call assert_equal("y Xcwdir2 1", GetCwdInfo(bufwinnr("y"), 0)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
94 call assert_equal("z Xcwdir3 1", GetCwdInfo(bufwinnr("z"), 0)) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
95 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
|
96 let tp_nr = tabpagenr() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
97 tabrewind |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
98 call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
99 call assert_equal("y Xcwdir2 1", GetCwdInfo(2, tp_nr)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
100 call assert_equal("z Xcwdir3 1", GetCwdInfo(1, tp_nr)) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
101 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
|
102 " 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 endfunc |
14834
ae62baca938c
patch 8.1.0429: no test for :lcd with 'shellslash'
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
114 |
ae62baca938c
patch 8.1.0429: no test for :lcd with 'shellslash'
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
115 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
|
116 new |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
117 let root = fnamemodify('/', ':p') |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
118 exe 'lcd '.root |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
119 let cwd = getcwd() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
120 if !exists('+shellslash') || &shellslash |
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 else |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
123 call assert_equal(cwd[-1:], '\') |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14834
diff
changeset
|
124 endif |
14834
ae62baca938c
patch 8.1.0429: no test for :lcd with 'shellslash'
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
125 endfunc |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
126 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
127 " 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
|
128 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
|
129 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
|
130 |
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('Xtabdir1') |
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('Xtabdir2') |
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('Xwindir1') |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
134 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
|
135 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
|
136 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
137 " 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
|
138 edit a |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
139 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
|
140 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
|
141 tabnew m |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
142 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
|
143 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
|
144 tabnew x |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
145 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
|
146 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
|
147 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
148 " 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
|
149 tabrewind |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
150 1wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
151 lcd Xwindir1 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
152 tabnext |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
153 tcd Xtabdir1 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
154 2wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
155 lcd ../Xwindir2 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
156 tabnext |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
157 tcd Xtabdir2 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
158 3wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
159 lcd ../Xwindir3 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
160 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
161 " 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
172 " 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
178 " 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 2wincmd w |
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(), ':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_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
|
190 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
|
191 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
|
192 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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 2wincmd w |
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(), ':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_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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 3wincmd w |
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(), ':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_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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
228 " 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
|
229 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
|
230 tabnew g |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
231 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
|
232 tabclose | tabrewind |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
233 2wincmd w |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
234 tabnew h |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
235 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
|
236 tabclose |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
237 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
|
238 tabnew j |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
239 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
|
240 tabclose |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
241 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
242 " 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
|
243 tabrewind | 1wincmd w |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
244 cd ../Xcwdir1 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
245 call assert_equal("a Xcwdir1 0", GetCwdInfo(1, 1)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
246 call assert_equal("b Xcwdir1 0", GetCwdInfo(2, 1)) |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
247 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
|
248 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
|
249 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
250 " 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
|
251 tabnext | 1wincmd w |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
252 cd ../Xcwdir3 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
253 call assert_equal("m Xcwdir3 0", GetCwdInfo(1, 2)) |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
254 call assert_equal("n Xwindir2 1", GetCwdInfo(2, 2)) |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
255 call assert_equal("o Xcwdir3 0", GetCwdInfo(3, 2)) |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
256 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
257 " 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
|
258 tabnext | 1wincmd w |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
259 cd ../Xcwdir1 |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
260 call assert_equal("x Xcwdir1 0", GetCwdInfo(1, 3)) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
261 call assert_equal("y Xcwdir1 0", GetCwdInfo(2, 3)) |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
262 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
|
263 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
264 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
|
265 new |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
266 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20003
diff
changeset
|
267 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20003
diff
changeset
|
268 " vim: shiftwidth=2 sts=2 expandtab |