diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-27 16:55:11 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-27 16:55:11 +0100 |
commit | 4389f9cd00632adc0216d5ead13d859b186bcbf8 (patch) | |
tree | 7bbafc23b6102f7ce39e8938d216c5d902db115c /src/testdir/test_vim9_cmd.vim | |
parent | e462f52db3cab656485a71e4322b6cb18d564a06 (diff) |
patch 8.2.2228: Vim9: cannot use ":e #" because # starts a commentv8.2.2228
Problem: Vim9: cannot use ":e #" because # starts a comment.
Solution: Support using %% instead of #.
Diffstat (limited to 'src/testdir/test_vim9_cmd.vim')
-rw-r--r-- | src/testdir/test_vim9_cmd.vim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim index f5619b488d..b6644e394b 100644 --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -25,6 +25,53 @@ def Test_edit_wildcards() CheckDefFailure(['edit `="foo"'], 'E1083:') enddef +def Test_expand_alternate_file() + var lines =<< trim END + edit Xfileone + var bone = bufnr() + edit Xfiletwo + var btwo = bufnr() + edit Xfilethree + var bthree = bufnr() + + edit # + assert_equal(bthree, bufnr()) + edit %% + assert_equal(btwo, bufnr()) + edit %% # comment + assert_equal(bthree, bufnr()) + edit %%yy + assert_equal('Xfiletwoyy', bufname()) + + exe "edit %%" .. bone + assert_equal(bone, bufnr()) + exe "edit %%" .. btwo .. "xx" + assert_equal('Xfiletwoxx', bufname()) + + next Xfileone Xfiletwo Xfilethree + assert_equal('Xfileone', argv(0)) + assert_equal('Xfiletwo', argv(1)) + assert_equal('Xfilethree', argv(2)) + next %%%zz + assert_equal('Xfileone', argv(0)) + assert_equal('Xfiletwo', argv(1)) + assert_equal('Xfilethreezz', argv(2)) + + v:oldfiles = ['Xonefile', 'Xtwofile'] + edit %%<1 + assert_equal('Xonefile', bufname()) + edit %%<2 + assert_equal('Xtwofile', bufname()) + assert_fails('edit %%<3', 'E684:') + + edit Xfileone.vim + edit Xfiletwo + edit %%:r + assert_equal('Xfileone', bufname()) + END + CheckDefAndScriptSuccess(lines) +enddef + def Test_global_backtick_expansion() new setline(1, 'xx') |