Mercurial > vim
annotate src/testdir/test_cd.vim @ 20528:489cb75c76b6 v8.2.0818
patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Commit: https://github.com/vim/vim/commit/822ba24743af9ee1b5e7f656a7a61a38f3638bca
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 24 23:00:18 2020 +0200
patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Problem: Vim9: using a discovery phase doesn't work well.
Solution: Remove the discovery phase, instead compile a function only when
it is used. Add :defcompile to compile def functions earlier.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 24 May 2020 23:15:04 +0200 |
parents | 94f05de75e9f |
children | b60bb094af52 |
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 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
4 |
11213
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 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
|
6 " This used to crash with a heap write overflow. |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call assert_fails('cd ' . repeat('x', 5000), 'E472:') |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 endfunc |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 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
|
11 let path = getcwd() |
290f5f6a2bac
patch 8.0.0493: crash with cd command with very long argument
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 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
|
13 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
|
14 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
|
15 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
|
16 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
|
17 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
18 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
|
19 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
|
20 " 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
|
21 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
|
22 cd |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
23 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
|
24 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
|
25 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
|
26 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
|
27 else |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
28 " 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
|
29 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
|
30 endif |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
31 endfunc |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
32 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
33 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
|
34 " 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
|
35 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
|
36 cd .. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
37 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
|
38 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
|
39 cd - |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
40 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
|
41 cd - |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
42 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
|
43 cd - |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
44 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
|
45 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
46 " 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 qall! |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
52 [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19261
diff
changeset
|
57 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
|
58 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
|
59 endfunc |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
60 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
61 func Test_cd_with_cpo_chdir() |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
62 e Xfoo |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
63 call setline(1, 'foo') |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
64 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
|
65 set cpo+=. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
66 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
67 " :cd should fail when buffer is modified and 'cpo' contains dot. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
68 call assert_fails('cd ..', 'E747:') |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
69 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
|
70 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
71 " :cd with exclamation mark should succeed. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
72 cd! .. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
73 call assert_notequal(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
|
74 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
75 " :cd should succeed when buffer has been written. |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
76 w! |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
77 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
|
78 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
|
79 |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
80 call delete('Xfoo') |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
81 set cpo& |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
82 bw! |
a1d21fc6e457
patch 8.1.0144: the :cd command does not have good test coverage
Christian Brabandt <cb@256bit.org>
parents:
11213
diff
changeset
|
83 endfunc |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
84 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
85 " Test for chdir() |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
86 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
|
87 let topdir = getcwd() |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
88 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
|
89 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
90 " 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
|
91 new |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
92 cd Xdir |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
93 tabnew |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
94 tcd y |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
95 below new |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
96 below new |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
97 lcd z |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
98 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
99 tabfirst |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
100 call chdir('..') |
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('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
|
102 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
|
103 tabnext | wincmd t |
17837
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
104 eval '..'->chdir() |
16576
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
105 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
|
106 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
|
107 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
|
108 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
|
109 3wincmd w |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
110 call chdir('..') |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 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
|
115 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
116 " Error case |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
117 call assert_fails("call chdir('dir-abcd')", 'E472:') |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
118 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
|
119 call assert_equal("", d) |
19261
a20c66f13a6e
patch 8.2.0189: cd() with NULL argument crashes
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
120 " Should not crash |
a20c66f13a6e
patch 8.2.0189: cd() with NULL argument crashes
Bram Moolenaar <Bram@vim.org>
parents:
18977
diff
changeset
|
121 call chdir(d) |
20158
94f05de75e9f
patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
122 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
|
123 |
bcc343175103
patch 8.1.1291: not easy to change directory and restore
Bram Moolenaar <Bram@vim.org>
parents:
14256
diff
changeset
|
124 only | tabonly |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
125 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
|
126 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
|
127 endfunc |
18977
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
128 |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
129 func Test_cd_completion() |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
130 call mkdir('XComplDir1', 'p') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
131 call mkdir('XComplDir2', 'p') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
132 call writefile([], 'XComplFile') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
133 |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
134 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
|
135 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
|
136 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
|
137 endfor |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
138 |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
139 call delete('XComplDir1', 'd') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
140 call delete('XComplDir2', 'd') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
141 call delete('XComplFile') |
5bef1043abff
patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
142 endfunc |