Mercurial > vim
annotate src/testdir/test_expand.vim @ 10275:6d8b2da002e9 v8.0.0034
commit https://github.com/vim/vim/commit/9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 15 15:39:39 2016 +0200
patch 8.0.0034
Problem: No completion for ":messages".
Solution: Complete "clear" argument. (Hirohito Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 15 Oct 2016 15:45:05 +0200 |
parents | 2b2e90fcd72b |
children | c62601adad69 |
rev | line source |
---|---|
7617
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for expanding file names |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_with_directories() |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 call mkdir('Xdir1') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 call mkdir('Xdir2') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 call mkdir('Xdir3') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 cd Xdir3 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call mkdir('Xdir4') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 cd .. |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 split Xdir1/file |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call setline(1, ['a', 'b']) |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 w |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 w Xdir3/Xdir4/file |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 close |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 next Xdir?/*/file |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal('Xdir3/Xdir4/file', expand('%')) |
7623
2720952e9acb
commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents:
7617
diff
changeset
|
19 if has('unix') |
2720952e9acb
commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents:
7617
diff
changeset
|
20 next! Xdir?/*/nofile |
2720952e9acb
commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents:
7617
diff
changeset
|
21 call assert_equal('Xdir?/*/nofile', expand('%')) |
2720952e9acb
commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents:
7617
diff
changeset
|
22 endif |
7643
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
23 " Edit another file, on MS-Windows the swap file would be in use and can't |
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
24 " be deleted. |
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
25 edit foo |
7617
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
7643
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
27 call assert_equal(0, delete('Xdir1', 'rf')) |
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
28 call assert_equal(0, delete('Xdir2', 'rf')) |
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
29 call assert_equal(0, delete('Xdir3', 'rf')) |
7617
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 endfunc |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 func Test_with_tilde() |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 let dir = getcwd() |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 call mkdir('Xdir ~ dir') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call assert_true(isdirectory('Xdir ~ dir')) |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 cd Xdir\ ~\ dir |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_true(getcwd() =~ 'Xdir \~ dir') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 exe 'cd ' . fnameescape(dir) |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call delete('Xdir ~ dir', 'd') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 call assert_false(isdirectory('Xdir ~ dir')) |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 endfunc |