annotate src/testdir/test_expand.vim @ 12588:5bc07e5d2c1f v8.0.1172

patch 8.0.1172: when E734 is given option is still set commit https://github.com/vim/vim/commit/2a6a6c3014e728cd01c750b0f60484d4eaf22a8c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 2 19:29:48 2017 +0200 patch 8.0.1172: when E734 is given option is still set Problem: When E734 is given option is still set. Solution: Assign NULL to "s". (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Mon, 02 Oct 2017 19:30:04 +0200
parents 2b2e90fcd72b
children c62601adad69
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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