comparison src/testdir/test_vim9_cmd.vim @ 23370:622e90acea5d v8.2.2228

patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment Commit: https://github.com/vim/vim/commit/4389f9cd00632adc0216d5ead13d859b186bcbf8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 27 16:55:11 2020 +0100 patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment Problem: Vim9: cannot use ":e #" because # starts a comment. Solution: Support using %% instead of #.
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Dec 2020 17:00:04 +0100
parents 456d625bb8c1
children 1371e21fdc3d
comparison
equal deleted inserted replaced
23369:a547793a18c1 23370:622e90acea5d
21 edit X`=filename`xx`=filenr`yy 21 edit X`=filename`xx`=filenr`yy
22 assert_equal('XXtestxx77yy', bufname()) 22 assert_equal('XXtestxx77yy', bufname())
23 23
24 CheckDefFailure(['edit `=xxx`'], 'E1001:') 24 CheckDefFailure(['edit `=xxx`'], 'E1001:')
25 CheckDefFailure(['edit `="foo"'], 'E1083:') 25 CheckDefFailure(['edit `="foo"'], 'E1083:')
26 enddef
27
28 def Test_expand_alternate_file()
29 var lines =<< trim END
30 edit Xfileone
31 var bone = bufnr()
32 edit Xfiletwo
33 var btwo = bufnr()
34 edit Xfilethree
35 var bthree = bufnr()
36
37 edit #
38 assert_equal(bthree, bufnr())
39 edit %%
40 assert_equal(btwo, bufnr())
41 edit %% # comment
42 assert_equal(bthree, bufnr())
43 edit %%yy
44 assert_equal('Xfiletwoyy', bufname())
45
46 exe "edit %%" .. bone
47 assert_equal(bone, bufnr())
48 exe "edit %%" .. btwo .. "xx"
49 assert_equal('Xfiletwoxx', bufname())
50
51 next Xfileone Xfiletwo Xfilethree
52 assert_equal('Xfileone', argv(0))
53 assert_equal('Xfiletwo', argv(1))
54 assert_equal('Xfilethree', argv(2))
55 next %%%zz
56 assert_equal('Xfileone', argv(0))
57 assert_equal('Xfiletwo', argv(1))
58 assert_equal('Xfilethreezz', argv(2))
59
60 v:oldfiles = ['Xonefile', 'Xtwofile']
61 edit %%<1
62 assert_equal('Xonefile', bufname())
63 edit %%<2
64 assert_equal('Xtwofile', bufname())
65 assert_fails('edit %%<3', 'E684:')
66
67 edit Xfileone.vim
68 edit Xfiletwo
69 edit %%:r
70 assert_equal('Xfileone', bufname())
71 END
72 CheckDefAndScriptSuccess(lines)
26 enddef 73 enddef
27 74
28 def Test_global_backtick_expansion() 75 def Test_global_backtick_expansion()
29 new 76 new
30 setline(1, 'xx') 77 setline(1, 'xx')