Mercurial > vim
annotate src/testdir/test_cd.vim @ 29102:fd9006d6ddcf v8.2.5072
patch 8.2.5072: using uninitialized value and freed memory in spell command
Commit: https://github.com/vim/vim/commit/2813f38e021c6e6581c0c88fcf107e41788bc835
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 9 19:54:24 2022 +0100
patch 8.2.5072: using uninitialized value and freed memory in spell command
Problem: Using uninitialized value and freed memory in spell command.
Solution: Initialize "attr". Check for empty line early.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 09 Jun 2022 21:00:04 +0200 |
parents | 1c22fcc7415c |
children | d891115c0aea |
rev | line source |
---|---|
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
1 " Test for :cd and chdir() |
11213
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
3 source shared.vim |
25200
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
4 source check.vim |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
5 |
11213
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_cd_large_path() |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " This used to crash with a heap write overflow. |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
8 call assert_fails('cd ' . repeat('x', 5000), 'E344:') |
11213
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 endfunc |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 func Test_cd_up_and_down() |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let path = getcwd() |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 cd .. |
14256
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
14 call assert_notequal(path, getcwd()) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
15 exe 'cd ' .. fnameescape(path) |
11213
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_equal(path, getcwd()) |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
14256
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
18 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
19 func Test_cd_no_arg() |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
20 if has('unix') |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
21 " Test that cd without argument goes to $HOME directory on Unix systems. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
22 let path = getcwd() |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
23 cd |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
24 call assert_equal($HOME, getcwd()) |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
25 call assert_notequal(path, getcwd()) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
26 exe 'cd ' .. fnameescape(path) |
14256
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
27 call assert_equal(path, getcwd()) |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
28 else |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
29 " Test that cd without argument echoes cwd on non-Unix systems. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
30 call assert_match(getcwd(), execute('cd')) |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
31 endif |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
32 endfunc |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
33 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
34 func Test_cd_minus() |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
35 " Test the :cd - goes back to the previous directory. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
36 let path = getcwd() |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
37 cd .. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
38 let path_dotdot = getcwd() |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
39 call assert_notequal(path, path_dotdot) |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
40 cd - |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
41 call assert_equal(path, getcwd()) |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
42 cd - |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
43 call assert_equal(path_dotdot, getcwd()) |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
44 cd - |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
45 call assert_equal(path, getcwd()) |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
46 |
26809
1c22fcc7415c
patch 8.2.3933: after ":cd" fails ":cd -" is incorrect
Bram Moolenaar <Bram@vim.org>
parents:
26412
diff
changeset
|
47 " Test for :cd - after a failed :cd |
1c22fcc7415c
patch 8.2.3933: after ":cd" fails ":cd -" is incorrect
Bram Moolenaar <Bram@vim.org>
parents:
26412
diff
changeset
|
48 call assert_fails('cd /nonexistent', 'E344:') |
1c22fcc7415c
patch 8.2.3933: after ":cd" fails ":cd -" is incorrect
Bram Moolenaar <Bram@vim.org>
parents:
26412
diff
changeset
|
49 call assert_equal(path, getcwd()) |
1c22fcc7415c
patch 8.2.3933: after ":cd" fails ":cd -" is incorrect
Bram Moolenaar <Bram@vim.org>
parents:
26412
diff
changeset
|
50 cd - |
1c22fcc7415c
patch 8.2.3933: after ":cd" fails ":cd -" is incorrect
Bram Moolenaar <Bram@vim.org>
parents:
26412
diff
changeset
|
51 call assert_equal(path_dotdot, getcwd()) |
1c22fcc7415c
patch 8.2.3933: after ":cd" fails ":cd -" is incorrect
Bram Moolenaar <Bram@vim.org>
parents:
26412
diff
changeset
|
52 cd - |
1c22fcc7415c
patch 8.2.3933: after ":cd" fails ":cd -" is incorrect
Bram Moolenaar <Bram@vim.org>
parents:
26412
diff
changeset
|
53 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
54 " Test for :cd - without a previous directory |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
55 let lines =<< trim [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
56 call assert_fails('cd -', 'E186:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
57 call assert_fails('call chdir("-")', 'E186:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
58 call writefile(v:errors, 'Xresult') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
59 qall! |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
60 [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
61 call writefile(lines, 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
62 if RunVim([], [], '--clean -S Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
63 call assert_equal([], readfile('Xresult')) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
64 endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
65 call delete('Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
66 call delete('Xresult') |
14256
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
67 endfunc |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
68 |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
69 " Test for chdir() |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
70 func Test_chdir_func() |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
71 let topdir = getcwd() |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
72 call mkdir('Xdir/y/z', 'p') |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
73 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
74 " Create a few tabpages and windows with different directories |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
75 new |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
76 cd Xdir |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
77 tabnew |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
78 tcd y |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
79 below new |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
80 below new |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
81 lcd z |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
82 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
83 tabfirst |
20645
b60bb094af52
patch 8.2.0876: :pwd does not give a hint about the scope of the directory
Bram Moolenaar <Bram@vim.org>
parents:
20158
diff
changeset
|
84 call assert_match('^\[global\] .*/Xdir$', trim(execute('verbose pwd'))) |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
85 call chdir('..') |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
86 call assert_equal('y', fnamemodify(getcwd(1, 2), ':t')) |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
87 call assert_equal('z', fnamemodify(3->getcwd(2), ':t')) |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
88 tabnext | wincmd t |
20645
b60bb094af52
patch 8.2.0876: :pwd does not give a hint about the scope of the directory
Bram Moolenaar <Bram@vim.org>
parents:
20158
diff
changeset
|
89 call assert_match('^\[tabpage\] .*/y$', trim(execute('verbose pwd'))) |
17837
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
90 eval '..'->chdir() |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
91 call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
92 call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
93 call assert_equal('z', fnamemodify(getcwd(3, 2), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
94 call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
95 3wincmd w |
20645
b60bb094af52
patch 8.2.0876: :pwd does not give a hint about the scope of the directory
Bram Moolenaar <Bram@vim.org>
parents:
20158
diff
changeset
|
96 call assert_match('^\[window\] .*/z$', trim(execute('verbose pwd'))) |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
97 call chdir('..') |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
98 call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
99 call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
100 call assert_equal('y', fnamemodify(getcwd(3, 2), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
101 call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
102 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
103 " Error case |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
104 call assert_fails("call chdir('dir-abcd')", 'E344:') |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
105 silent! let d = chdir("dir_abcd") |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
106 call assert_equal("", d) |
19261
a20c66f13a6e
patch 8.2.0189: cd() with NULL argument crashes
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
107 " Should not crash |
a20c66f13a6e
patch 8.2.0189: cd() with NULL argument crashes
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
108 call chdir(d) |
20158
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
109 call assert_equal('', chdir([])) |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
110 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
111 only | tabonly |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
112 call chdir(topdir) |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
113 call delete('Xdir', 'rf') |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
114 endfunc |
18977
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
115 |
20711
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
116 " Test for changing to the previous directory '-' |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
117 func Test_prev_dir() |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
118 let topdir = getcwd() |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
119 call mkdir('Xdir/a/b/c', 'p') |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
120 |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
121 " Create a few tabpages and windows with different directories |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
122 new | only |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
123 tabnew | new |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
124 tabnew |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
125 tabfirst |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
126 cd Xdir |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
127 tabnext | wincmd t |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
128 tcd a |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
129 wincmd w |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
130 lcd b |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
131 tabnext |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
132 tcd a/b/c |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
133 |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
134 " Change to the previous directory twice in all the windows. |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
135 tabfirst |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
136 cd - | cd - |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
137 tabnext | wincmd t |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
138 tcd - | tcd - |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
139 wincmd w |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
140 lcd - | lcd - |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
141 tabnext |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
142 tcd - | tcd - |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
143 |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
144 " Check the directory of all the windows |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
145 tabfirst |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
146 call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
147 tabnext | wincmd t |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
148 call assert_equal('a', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
149 wincmd w |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
150 call assert_equal('b', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
151 tabnext |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
152 call assert_equal('c', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
153 |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
154 " Change to the previous directory using chdir() |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
155 tabfirst |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
156 call chdir("-") | call chdir("-") |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
157 tabnext | wincmd t |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
158 call chdir("-") | call chdir("-") |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
159 wincmd w |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
160 call chdir("-") | call chdir("-") |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
161 tabnext |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
162 call chdir("-") | call chdir("-") |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
163 |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
164 " Check the directory of all the windows |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
165 tabfirst |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
166 call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
167 tabnext | wincmd t |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
168 call assert_equal('a', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
169 wincmd w |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
170 call assert_equal('b', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
171 tabnext |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
172 call assert_equal('c', fnamemodify(getcwd(), ':t')) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
173 |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
174 only | tabonly |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
175 call chdir(topdir) |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
176 call delete('Xdir', 'rf') |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
177 endfunc |
d91b8d1e5198
patch 8.2.0909: cannot go back to the previous local directory
Bram Moolenaar <Bram@vim.org>
parents:
20645
diff
changeset
|
178 |
21723
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
179 func Test_lcd_split() |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
180 let curdir = getcwd() |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
181 lcd .. |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
182 split |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
183 lcd - |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
184 call assert_equal(curdir, getcwd()) |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
185 quit! |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
186 endfunc |
5b0796787cb2
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
187 |
25200
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
188 func Test_cd_from_non_existing_dir() |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
189 CheckNotMSWindows |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
190 |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
191 let saveddir = getcwd() |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
192 call mkdir('Xdeleted_dir') |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
193 cd Xdeleted_dir |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
194 call delete(saveddir .. '/Xdeleted_dir', 'd') |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
195 |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
196 " Expect E187 as the current directory was deleted. |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
197 call assert_fails('pwd', 'E187:') |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
198 call assert_equal('', getcwd()) |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
199 cd - |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
200 call assert_equal(saveddir, getcwd()) |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
201 endfunc |
da0e5ff44b14
patch 8.2.3136: no test for E187 and "No swap file"
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
202 |
18977
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
203 func Test_cd_completion() |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
204 call mkdir('XComplDir1', 'p') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
205 call mkdir('XComplDir2', 'p') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
206 call writefile([], 'XComplFile') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
207 |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
208 for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir'] |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
209 call feedkeys(':' .. cmd .. " XCompl\<C-A>\<C-B>\"\<CR>", 'tx') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
210 call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/', @:) |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
211 endfor |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
212 |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
213 call delete('XComplDir1', 'd') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
214 call delete('XComplDir2', 'd') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
215 call delete('XComplFile') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
216 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21723
diff
changeset
|
217 |
25868
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
218 func Test_cd_unknown_dir() |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
219 call mkdir('Xa') |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
220 cd Xa |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
221 call writefile(['text'], 'Xb.txt') |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
222 edit Xa/Xb.txt |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
223 let first_buf = bufnr() |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
224 cd .. |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
225 edit |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
226 call assert_equal(first_buf, bufnr()) |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
227 edit Xa/Xb.txt |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
228 call assert_notequal(first_buf, bufnr()) |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
229 |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
230 bwipe! |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
231 exe "bwipe! " .. first_buf |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
232 call delete('Xa', 'rf') |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
233 endfunc |
bcf55847d2ed
patch 8.2.3468: problem with :cd when editing file in non-existent directory
Bram Moolenaar <Bram@vim.org>
parents:
25200
diff
changeset
|
234 |
26173
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
235 func Test_getcwd_actual_dir() |
26412
40f6330abc2c
patch 8.2.3737: test fails without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26173
diff
changeset
|
236 CheckOption autochdir |
40f6330abc2c
patch 8.2.3737: test fails without the 'autochdir' option
Bram Moolenaar <Bram@vim.org>
parents:
26173
diff
changeset
|
237 |
26173
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
238 let startdir = getcwd() |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
239 call mkdir('Xactual') |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
240 call test_autochdir() |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
241 set autochdir |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
242 edit Xactual/file.txt |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
243 call assert_match('testdir.Xactual$', getcwd()) |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
244 lcd .. |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
245 call assert_match('testdir$', getcwd()) |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
246 edit |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
247 call assert_match('testdir.Xactual$', getcwd()) |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
248 call assert_match('testdir$', getcwd(win_getid())) |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
249 |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
250 set noautochdir |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
251 bwipe! |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
252 call chdir(startdir) |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
253 call delete('Xactual', 'rf') |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
254 endfunc |
460790b520dd
patch 8.2.3618: getcwd() is unclear about how 'autochdir' is used
Bram Moolenaar <Bram@vim.org>
parents:
25868
diff
changeset
|
255 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21723
diff
changeset
|
256 " vim: shiftwidth=2 sts=2 expandtab |