Mercurial > vim
annotate src/testdir/test_expand.vim @ 24610:c1263588156b v8.2.2844
patch 8.2.2844: Vim9: memory leak when using searchpair()
Commit: https://github.com/vim/vim/commit/24f720998f852dd1ba861ec67d56625a507b915e
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 7 20:43:54 2021 +0200
patch 8.2.2844: Vim9: memory leak when using searchpair()
Problem: Vim9: memory leak when using searchpair().
Solution: Free the v_instr field.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 07 May 2021 20:45:03 +0200 |
parents | 2c4d9ca33769 |
children | 9865f996a3c0 |
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 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
3 source shared.vim |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
4 |
7617
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func Test_with_directories() |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 call mkdir('Xdir1') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call mkdir('Xdir2') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call mkdir('Xdir3') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 cd Xdir3 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call mkdir('Xdir4') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 cd .. |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 split Xdir1/file |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call setline(1, ['a', 'b']) |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 w |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 w Xdir3/Xdir4/file |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 close |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 next Xdir?/*/file |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 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
|
21 if has('unix') |
2720952e9acb
commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents:
7617
diff
changeset
|
22 next! Xdir?/*/nofile |
2720952e9acb
commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents:
7617
diff
changeset
|
23 call assert_equal('Xdir?/*/nofile', expand('%')) |
2720952e9acb
commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents:
7617
diff
changeset
|
24 endif |
7643
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
25 " 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
|
26 " be deleted. |
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
27 edit foo |
7617
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 |
7643
2b2e90fcd72b
commit https://github.com/vim/vim/commit/08b270a8a4544be9a7fecce311834fde2b457634
Christian Brabandt <cb@256bit.org>
parents:
7623
diff
changeset
|
29 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
|
30 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
|
31 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
|
32 endfunc |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 func Test_with_tilde() |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 let dir = getcwd() |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 call mkdir('Xdir ~ dir') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_true(isdirectory('Xdir ~ dir')) |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 cd Xdir\ ~\ dir |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call assert_true(getcwd() =~ 'Xdir \~ dir') |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
40 call chdir(dir) |
7617
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 call delete('Xdir ~ dir', 'd') |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call assert_false(isdirectory('Xdir ~ dir')) |
80bc36419c21
commit https://github.com/vim/vim/commit/58adb14739fa240ca6020cede9ab1f1cb07bd90a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 endfunc |
14393
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
44 |
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
45 func Test_expand_tilde_filename() |
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
46 split ~ |
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
47 call assert_equal('~', expand('%')) |
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
48 call assert_notequal(expand('%:p'), expand('~/')) |
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
49 call assert_match('\~', expand('%:p')) |
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
50 bwipe! |
c62601adad69
patch 8.1.0211: expanding a file name "~" results in $HOME
Christian Brabandt <cb@256bit.org>
parents:
7643
diff
changeset
|
51 endfunc |
17020
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
52 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
53 func Test_expandcmd() |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
54 let $FOO = 'Test' |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
55 call assert_equal('e x/Test/y', expandcmd('e x/$FOO/y')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
56 unlet $FOO |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
57 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
58 new |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
59 edit Xfile1 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
60 call assert_equal('e Xfile1', expandcmd('e %')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
61 edit Xfile2 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
62 edit Xfile1 |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17020
diff
changeset
|
63 call assert_equal('e Xfile2', 'e #'->expandcmd()) |
17020
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
64 edit Xfile2 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
65 edit Xfile3 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
66 edit Xfile4 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
67 let bnum = bufnr('Xfile2') |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
68 call assert_equal('e Xfile2', expandcmd('e #' . bnum)) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
69 call setline('.', 'Vim!@#') |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
70 call assert_equal('e Vim', expandcmd('e <cword>')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
71 call assert_equal('e Vim!@#', expandcmd('e <cWORD>')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
72 enew! |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
73 edit Xfile.java |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
74 call assert_equal('e Xfile.py', expandcmd('e %:r.py')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
75 call assert_equal('make abc.java', expandcmd('make abc.%:e')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
76 call assert_equal('make Xabc.java', expandcmd('make %:s?file?abc?')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
77 edit a1a2a3.rb |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
78 call assert_equal('make b1b2b3.rb a1a2a3 Xfile.o', expandcmd('make %:gs?a?b? %< #<.o')) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
79 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
80 call assert_fails('call expandcmd("make <afile>")', 'E495:') |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
81 call assert_fails('call expandcmd("make <afile>")', 'E495:') |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
82 enew |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
83 call assert_fails('call expandcmd("make %")', 'E499:') |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
84 let $FOO="blue\tsky" |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
85 call setline(1, "$FOO") |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
86 call assert_equal("grep pat blue\tsky", expandcmd('grep pat <cfile>')) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
87 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
88 " Test for expression expansion `= |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
89 let $FOO= "blue" |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
90 call assert_equal("blue sky", expandcmd("`=$FOO .. ' sky'`")) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
91 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
92 " Test for env variable with spaces |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
93 let $FOO= "foo bar baz" |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
94 call assert_equal("e foo bar baz", expandcmd("e $FOO")) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
95 |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
96 unlet $FOO |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
97 close! |
17020
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
14393
diff
changeset
|
98 endfunc |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
99 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
100 " Test for expanding <sfile>, <slnum> and <sflnum> outside of sourcing a script |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
101 func Test_source_sfile() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
102 let lines =<< trim [SCRIPT] |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
103 :call assert_fails('echo expandcmd("<sfile>")', 'E498:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
104 :call assert_fails('echo expandcmd("<slnum>")', 'E842:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
105 :call assert_fails('echo expandcmd("<sflnum>")', 'E961:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
106 :call assert_fails('call expandcmd("edit <cfile>")', 'E446:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
107 :call assert_fails('call expandcmd("edit #")', 'E194:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
108 :call assert_fails('call expandcmd("edit #<2")', 'E684:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
109 :call assert_fails('call expandcmd("edit <cword>")', 'E348:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
110 :call assert_fails('call expandcmd("edit <cexpr>")', 'E348:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
111 :call assert_fails('autocmd User MyCmd echo "<sfile>"', 'E498:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
112 :call writefile(v:errors, 'Xresult') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
113 :qall! |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
114 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
115 [SCRIPT] |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
116 call writefile(lines, 'Xscript') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
117 if RunVim([], [], '--clean -s Xscript') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
118 call assert_equal([], readfile('Xresult')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
119 endif |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
120 call delete('Xscript') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
121 call delete('Xresult') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
122 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
123 |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
124 " Test for expanding filenames multiple times in a command line |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
125 func Test_expand_filename_multicmd() |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
126 edit foo |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
127 call setline(1, 'foo!') |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
128 new |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
129 call setline(1, 'foo!') |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
130 new <cword> | new <cWORD> |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
131 call assert_equal(4, winnr('$')) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
132 call assert_equal('foo!', bufname(winbufnr(1))) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
133 call assert_equal('foo', bufname(winbufnr(2))) |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
134 call assert_fails('e %:s/.*//', 'E500:') |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
135 %bwipe! |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
136 endfunc |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
137 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
138 " vim: shiftwidth=2 sts=2 expandtab |