annotate src/testdir/test_vim9_cmd.vim @ 23966:09bde146adcb v8.2.2525

patch 8.2.2525: Vim9: only local variables checked for a name Commit: https://github.com/vim/vim/commit/e0890d678d4d31ca1810c90f3afe2ba89dfedcfa Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 17 14:52:14 2021 +0100 patch 8.2.2525: Vim9: only local variables checked for a name Problem: Vim9: only local variables checked for a name. Solution: Also check arguments and script variables. (closes https://github.com/vim/vim/issues/7838)
author Bram Moolenaar <Bram@vim.org>
date Wed, 17 Feb 2021 15:00:04 +0100
parents 2a885d095bff
children fc4c2beea99a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test commands that are not compiled in a :def function
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
3 source check.vim
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source vim9.vim
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
5 source term_util.vim
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
6 source view_util.vim
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
23938
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
8 def Test_vim9cmd()
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
9 var lines =<< trim END
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
10 vim9cmd var x = 123
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
11 let s:y = 'yes'
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
12 vim9c assert_equal(123, x)
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
13 vim9cm assert_equal('yes', y)
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
14 END
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
15 CheckScriptSuccess(lines)
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
16 enddef
2a885d095bff patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places
Bram Moolenaar <Bram@vim.org>
parents: 23823
diff changeset
17
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 def Test_edit_wildcards()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
19 var filename = 'Xtest'
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 edit `=filename`
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 assert_equal('Xtest', bufname())
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
23 var filenr = 123
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 edit Xtest`=filenr`
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 assert_equal('Xtest123', bufname())
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 filenr = 77
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 edit `=filename``=filenr`
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 assert_equal('Xtest77', bufname())
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 edit X`=filename`xx`=filenr`yy
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 assert_equal('XXtestxx77yy', bufname())
23197
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
33
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
34 CheckDefFailure(['edit `=xxx`'], 'E1001:')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
35 CheckDefFailure(['edit `="foo"'], 'E1083:')
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 enddef
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
23370
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
38 def Test_expand_alternate_file()
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
39 var lines =<< trim END
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
40 edit Xfileone
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
41 var bone = bufnr()
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
42 edit Xfiletwo
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
43 var btwo = bufnr()
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
44 edit Xfilethree
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
45 var bthree = bufnr()
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
46
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
47 edit #
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
48 assert_equal(bthree, bufnr())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
49 edit %%
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
50 assert_equal(btwo, bufnr())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
51 edit %% # comment
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
52 assert_equal(bthree, bufnr())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
53 edit %%yy
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
54 assert_equal('Xfiletwoyy', bufname())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
55
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
56 exe "edit %%" .. bone
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
57 assert_equal(bone, bufnr())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
58 exe "edit %%" .. btwo .. "xx"
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
59 assert_equal('Xfiletwoxx', bufname())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
60
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
61 next Xfileone Xfiletwo Xfilethree
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
62 assert_equal('Xfileone', argv(0))
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
63 assert_equal('Xfiletwo', argv(1))
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
64 assert_equal('Xfilethree', argv(2))
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
65 next %%%zz
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
66 assert_equal('Xfileone', argv(0))
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
67 assert_equal('Xfiletwo', argv(1))
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
68 assert_equal('Xfilethreezz', argv(2))
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
69
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
70 v:oldfiles = ['Xonefile', 'Xtwofile']
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
71 edit %%<1
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
72 assert_equal('Xonefile', bufname())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
73 edit %%<2
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
74 assert_equal('Xtwofile', bufname())
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
75 assert_fails('edit %%<3', 'E684:')
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
76
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
77 edit Xfileone.vim
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
78 edit Xfiletwo
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
79 edit %%:r
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
80 assert_equal('Xfileone', bufname())
23711
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
81
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
82 assert_false(bufexists('altfoo'))
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
83 edit altfoo
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
84 edit bar
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
85 assert_true(bufexists('altfoo'))
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
86 assert_true(buflisted('altfoo'))
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
87 bdel %%
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
88 assert_true(bufexists('altfoo'))
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
89 assert_false(buflisted('altfoo'))
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
90 bwipe! altfoo
29eccef07e2f patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Bram Moolenaar <Bram@vim.org>
parents: 23709
diff changeset
91 bwipe! bar
23370
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
92 END
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
93 CheckDefAndScriptSuccess(lines)
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
94 enddef
622e90acea5d patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment
Bram Moolenaar <Bram@vim.org>
parents: 23348
diff changeset
95
23344
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
96 def Test_global_backtick_expansion()
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
97 new
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
98 setline(1, 'xx')
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
99 var name = 'foobar'
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
100 g/^xx/s/.*/`=name`
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
101 assert_equal('foobar', getline(1))
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
102 bwipe!
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
103 enddef
1f37fd20f851 patch 8.2.2215: Vim9: not recognized in global command
Bram Moolenaar <Bram@vim.org>
parents: 23274
diff changeset
104
23521
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
105 def Test_folddo_backtick_expansion()
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
106 new
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
107 var name = 'xxx'
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
108 folddoopen edit `=name`
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
109 assert_equal('xxx', bufname())
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
110 bwipe!
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
111
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
112 new
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
113 setline(1, ['one', 'two'])
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
114 set nomodified
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
115 :1,2fold
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
116 foldclose
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
117 folddoclose edit `=name`
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
118 assert_equal('xxx', bufname())
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
119 bwipe!
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
120 enddef
0ef920a03380 patch 8.2.2303: Vim9: backtick expansion doesn't work for :foldopen
Bram Moolenaar <Bram@vim.org>
parents: 23513
diff changeset
121
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
122 def Test_hardcopy_wildcards()
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
123 CheckUnix
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
124 CheckFeature postscript
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
125
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
126 var outfile = 'print'
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
127 hardcopy > X`=outfile`.ps
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
128 assert_true(filereadable('Xprint.ps'))
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
129
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
130 delete('Xprint.ps')
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
131 enddef
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
132
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
133 def Test_syn_include_wildcards()
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
134 writefile(['syn keyword Found found'], 'Xthemine.vim')
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
135 var save_rtp = &rtp
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
136 &rtp = '.'
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
137
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
138 var fname = 'mine'
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
139 syn include @Group Xthe`=fname`.vim
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
140 assert_match('Found.* contained found', execute('syn list Found'))
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
141
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
142 &rtp = save_rtp
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
143 delete('Xthemine.vim')
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
144 enddef
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
145
21048
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
146 def Test_echo_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
147 var lines =<< trim END
21048
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
148 vim9script
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
149 redir @a
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
150 echo 'one'
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
151 .. 'two'
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
152 redir END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
153 assert_equal("\nonetwo", @a)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
154 END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
155 CheckScriptSuccess(lines)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
156
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
157 lines =<< trim END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
158 vim9script
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
159 redir @a
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
160 echo 11 +
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
161 77
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
162 - 22
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
163 redir END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
164 assert_equal("\n66", @a)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
165 END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
166 CheckScriptSuccess(lines)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
167 enddef
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
168
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
169 def Test_condition_types()
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
170 var lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
171 if 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
172 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
173 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
174 CheckDefAndScriptFailure(lines, 'E1135:', 1)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
175
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
176 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
177 if [1]
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
178 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
179 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
180 CheckDefFailure(lines, 'E1012:', 1)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
181 CheckScriptFailure(['vim9script'] + lines, 'E745:', 2)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
182
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
183 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
184 g:cond = 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
185 if g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
186 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
187 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
188 CheckDefExecAndScriptFailure(lines, 'E1135:', 2)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
189
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
190 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
191 g:cond = 0
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
192 if g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
193 elseif 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
194 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
195 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
196 CheckDefFailure(lines, 'E1012:', 3)
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
197 CheckScriptFailure(['vim9script'] + lines, 'E1135:', 4)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
198
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
199 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
200 if g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
201 elseif [1]
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
202 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
203 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
204 CheckDefFailure(lines, 'E1012:', 2)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
205 CheckScriptFailure(['vim9script'] + lines, 'E745:', 3)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
206
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
207 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
208 g:cond = 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
209 if 0
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
210 elseif g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
211 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
212 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
213 CheckDefExecAndScriptFailure(lines, 'E1135:', 3)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
214
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
215 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
216 while 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
217 endwhile
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
218 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
219 CheckDefFailure(lines, 'E1012:', 1)
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
220 CheckScriptFailure(['vim9script'] + lines, 'E1135:', 2)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
221
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
222 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
223 while [1]
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
224 endwhile
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
225 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
226 CheckDefFailure(lines, 'E1012:', 1)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
227 CheckScriptFailure(['vim9script'] + lines, 'E745:', 2)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
228
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
229 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
230 g:cond = 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
231 while g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
232 endwhile
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
233 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
234 CheckDefExecAndScriptFailure(lines, 'E1135:', 2)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
235 enddef
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
236
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
237 def Test_if_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
238 var lines =<< trim END
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
239 vim9script
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
240 if 1 &&
22494
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
241 true
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
242 || 1
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
243 g:res = 42
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
244 endif
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
245 assert_equal(42, g:res)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
246 END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
247 CheckScriptSuccess(lines)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
248 unlet g:res
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
249
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
250 lines =<< trim END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
251 vim9script
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
252 if 1 &&
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
253 0
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
254 g:res = 0
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
255 elseif 0 ||
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
256 0
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
257 || 1
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
258 g:res = 12
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
259 endif
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
260 assert_equal(12, g:res)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
261 END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
262 CheckScriptSuccess(lines)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
263 unlet g:res
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
264 enddef
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
265
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
266 def Test_while_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
267 var lines =<< trim END
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
268 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
269 var nr = 0
21056
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
270 while nr <
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
271 10 + 3
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
272 nr = nr
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
273 + 4
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
274 endwhile
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
275 assert_equal(16, nr)
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
276 END
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
277 CheckScriptSuccess(lines)
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
278
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
279 lines =<< trim END
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
280 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
281 var nr = 0
21056
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
282 while nr
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
283 <
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
284 10
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
285 +
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
286 3
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
287 nr = nr
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
288 +
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
289 4
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
290 endwhile
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
291 assert_equal(16, nr)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
292 END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
293 CheckScriptSuccess(lines)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
294 enddef
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
296 def Test_for_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
297 var lines =<< trim END
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
298 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
299 var nr = 0
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
300 for x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
301 in
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
302 [1, 2, 3, 4]
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
303 nr = nr + x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
304 endfor
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
305 assert_equal(10, nr)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
306 END
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
307 CheckScriptSuccess(lines)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
308
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
309 lines =<< trim END
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
310 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
311 var nr = 0
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
312 for x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
313 in
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
314 [1, 2,
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
315 3, 4
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
316 ]
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
317 nr = nr
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
318 +
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
319 x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
320 endfor
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
321 assert_equal(10, nr)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
322 END
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
323 CheckScriptSuccess(lines)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
324 enddef
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
325
23966
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
326 def MethodAfterLinebreak(arg: string)
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
327 arg
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
328 ->setline(1)
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
329 enddef
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
330
21130
4a1e8086759b patch 8.2.1116: Vim9: parsing command checks for list twice
Bram Moolenaar <Bram@vim.org>
parents: 21122
diff changeset
331 def Test_method_call_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
332 var lines =<< trim END
21122
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
333 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
334 var res = []
21122
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
335 func RetArg(
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
336 arg
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
337 )
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
338 let s:res = a:arg
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
339 endfunc
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
340 [1,
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
341 2,
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
342 3]->RetArg()
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
343 assert_equal([1, 2, 3], res)
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
344 END
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
345 CheckScriptSuccess(lines)
23823
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
346
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
347 lines =<< trim END
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
348 new
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
349 var name = [1, 2]
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
350 name
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
351 ->copy()
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
352 ->setline(1)
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
353 assert_equal(['1', '2'], getline(1, 2))
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
354 bwipe!
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
355 END
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
356 CheckDefAndScriptSuccess(lines)
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
357
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
358 lines =<< trim END
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
359 new
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
360 g:shortlist
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
361 ->copy()
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
362 ->setline(1)
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
363 assert_equal(['1', '2'], getline(1, 2))
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
364 bwipe!
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
365 END
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
366 g:shortlist = [1, 2]
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
367 CheckDefAndScriptSuccess(lines)
262ab14b27db patch 8.2.2453: Vim9: a variable name with "->" in the next line doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 23711
diff changeset
368 unlet g:shortlist
23966
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
369
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
370 new
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
371 MethodAfterLinebreak('foobar')
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
372 assert_equal('foobar', getline(1))
09bde146adcb patch 8.2.2525: Vim9: only local variables checked for a name
Bram Moolenaar <Bram@vim.org>
parents: 23938
diff changeset
373 bwipe!
21122
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
374 enddef
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
375
23709
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
376 def Test_method_call_whitespace()
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
377 var lines =<< trim END
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
378 new
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
379 var yank = 'text'
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
380 yank->setline(1)
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
381 yank ->setline(2)
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
382 yank-> setline(3)
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
383 yank -> setline(4)
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
384 assert_equal(['text', 'text', 'text', 'text'], getline(1, 4))
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
385 bwipe!
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
386 END
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
387 CheckDefAndScriptSuccess(lines)
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
388 enddef
a0c4d04a58c4 patch 8.2.2396: Vim9: no white space allowed before "->"
Bram Moolenaar <Bram@vim.org>
parents: 23671
diff changeset
389
22685
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
390 def Test_skipped_expr_linebreak()
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
391 if 0
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
392 var x = []
23428
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23422
diff changeset
393 ->map(() => 0)
22685
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
394 endif
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
395 enddef
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
396
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
397 def Test_dict_member()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
398 var test: dict<list<number>> = {data: [3, 1, 2]}
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
399 test.data->sort()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
400 assert_equal({data: [1, 2, 3]}, test)
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
401 test.data
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
402 ->reverse()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
403 assert_equal({data: [3, 2, 1]}, test)
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
404
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
405 var lines =<< trim END
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
406 vim9script
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
407 var test: dict<list<number>> = {data: [3, 1, 2]}
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
408 test.data->sort()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
409 assert_equal({data: [1, 2, 3]}, test)
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
410 END
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
411 CheckScriptSuccess(lines)
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
412 enddef
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
413
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
414 def Test_bar_after_command()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
415 def RedrawAndEcho()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
416 var x = 'did redraw'
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
417 redraw | echo x
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
418 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
419 RedrawAndEcho()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
420 assert_match('did redraw', Screenline(&lines))
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
421
21158
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
422 def CallAndEcho()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
423 var x = 'did redraw'
21158
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
424 reg_executing() | echo x
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
425 enddef
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
426 CallAndEcho()
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
427 assert_match('did redraw', Screenline(&lines))
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
428
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
429 if has('unix')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
430 # bar in filter write command does not start new command
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
431 def WriteToShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
432 new
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
433 setline(1, 'some text')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
434 w !cat | cat > Xoutfile
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
435 bwipe!
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
436 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
437 WriteToShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
438 assert_equal(['some text'], readfile('Xoutfile'))
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
439 delete('Xoutfile')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
440
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
441 # bar in filter read command does not start new command
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
442 def ReadFromShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
443 new
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
444 r! echo hello there | cat > Xoutfile
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
445 r !echo again | cat >> Xoutfile
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
446 bwipe!
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
447 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
448 ReadFromShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
449 assert_equal(['hello there', 'again'], readfile('Xoutfile'))
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
450 delete('Xoutfile')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
451 endif
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
452 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
453
21255
4be91a7eafb2 patch 8.2.1178: Vim9: filter function recognized as command modifier
Bram Moolenaar <Bram@vim.org>
parents: 21212
diff changeset
454 def Test_filter_is_not_modifier()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
455 var tags = [{a: 1, b: 2}, {x: 3, y: 4}]
23428
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23422
diff changeset
456 filter(tags, ( _, v) => has_key(v, 'x') ? 1 : 0 )
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
457 assert_equal([{x: 3, y: 4}], tags)
21255
4be91a7eafb2 patch 8.2.1178: Vim9: filter function recognized as command modifier
Bram Moolenaar <Bram@vim.org>
parents: 21212
diff changeset
458 enddef
4be91a7eafb2 patch 8.2.1178: Vim9: filter function recognized as command modifier
Bram Moolenaar <Bram@vim.org>
parents: 21212
diff changeset
459
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
460 def Test_command_modifier_filter()
22750
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
461 var lines =<< trim END
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
462 final expected = "\nType Name Content\n c \"c piyo"
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
463 @a = 'hoge'
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
464 @b = 'fuga'
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
465 @c = 'piyo'
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
466
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
467 assert_equal(execute('filter /piyo/ registers abc'), expected)
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
468 END
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
469 CheckDefAndScriptSuccess(lines)
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
470 enddef
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
471
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
472 def Test_win_command_modifiers()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
473 assert_equal(1, winnr('$'))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
474
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
475 set splitright
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
476 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
477 assert_equal(2, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
478 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
479 aboveleft vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
480 assert_equal(1, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
481 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
482 set splitright&
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
483
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
484 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
485 assert_equal(1, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
486 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
487 belowright vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
488 assert_equal(2, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
489 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
490 rightbelow vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
491 assert_equal(2, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
492 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
493
22784
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
494 if has('browse')
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
495 browse set
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
496 assert_equal('option-window', expand('%'))
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
497 close
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
498 endif
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
499
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
500 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
501 botright split
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
502 assert_equal(3, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
503 assert_equal(&columns, winwidth(0))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
504 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
505 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
506
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
507 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
508 topleft split
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
509 assert_equal(1, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
510 assert_equal(&columns, winwidth(0))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
511 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
512 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
513
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
514 gettabinfo()->len()->assert_equal(1)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
515 tab split
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
516 gettabinfo()->len()->assert_equal(2)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
517 tabclose
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
518
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
519 vertical new
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
520 assert_inrange(&columns / 2 - 2, &columns / 2 + 1, winwidth(0))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
521 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
522 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
523
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
524 func Test_command_modifier_confirm()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
525 CheckNotGui
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
526 CheckRunVimInTerminal
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
527
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
528 " Test for saving all the modified buffers
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
529 let lines =<< trim END
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
530 call setline(1, 'changed')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
531 def Getout()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
532 confirm write Xfile
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
533 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
534 END
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
535 call writefile(lines, 'Xconfirmscript')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
536 call writefile(['empty'], 'Xfile')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
537 let buf = RunVimInTerminal('-S Xconfirmscript', {'rows': 8})
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
538 call term_sendkeys(buf, ":call Getout()\n")
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
539 call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
540 call term_sendkeys(buf, "y")
22778
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
541 call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
542 call term_sendkeys(buf, "\<CR>")
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
543 call TermWait(buf)
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
544 call StopVimInTerminal(buf)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
545
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
546 call assert_equal(['changed'], readfile('Xfile'))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
547 call delete('Xfile')
22778
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
548 call delete('.Xfile.swp') " in case Vim was killed
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
549 call delete('Xconfirmscript')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
550 endfunc
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
551
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
552 def Test_command_modifiers_keep()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
553 if has('unix')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
554 def DoTest(addRflag: bool, keepMarks: bool, hasMarks: bool)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
555 new
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
556 setline(1, ['one', 'two', 'three'])
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
557 normal 1Gma
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
558 normal 2Gmb
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
559 normal 3Gmc
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
560 if addRflag
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
561 set cpo+=R
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
562 else
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
563 set cpo-=R
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
564 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
565 if keepMarks
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
566 keepmarks :%!cat
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
567 else
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
568 :%!cat
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
569 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
570 if hasMarks
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
571 assert_equal(1, line("'a"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
572 assert_equal(2, line("'b"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
573 assert_equal(3, line("'c"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
574 else
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
575 assert_equal(0, line("'a"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
576 assert_equal(0, line("'b"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
577 assert_equal(0, line("'c"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
578 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
579 quit!
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
580 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
581 DoTest(false, false, true)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
582 DoTest(true, false, false)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
583 DoTest(false, true, true)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
584 DoTest(true, true, true)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
585 set cpo&vim
22812
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
586
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
587 new
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
588 setline(1, ['one', 'two', 'three', 'four'])
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
589 assert_equal(4, line("$"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
590 normal 1Gma
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
591 normal 2Gmb
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
592 normal 3Gmc
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
593 lockmarks :1,2!wc
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
594 # line is deleted, marks don't move
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
595 assert_equal(3, line("$"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
596 assert_equal('four', getline(3))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
597 assert_equal(1, line("'a"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
598 assert_equal(2, line("'b"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
599 assert_equal(3, line("'c"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
600 quit!
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
601 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
602
22812
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
603 edit Xone
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
604 edit Xtwo
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
605 assert_equal('Xone', expand('#'))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
606 keepalt edit Xthree
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
607 assert_equal('Xone', expand('#'))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
608
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
609 normal /a*b*
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
610 assert_equal('a*b*', histget("search"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
611 keeppatterns normal /c*d*
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
612 assert_equal('a*b*', histget("search"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
613
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
614 new
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
615 setline(1, range(10))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
616 :10
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
617 normal gg
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
618 assert_equal(10, getpos("''")[1])
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
619 keepjumps normal 5G
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
620 assert_equal(10, getpos("''")[1])
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
621 quit!
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
622 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
623
23398
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
624 def Test_bar_line_continuation()
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
625 var lines =<< trim END
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
626 au BufNewFile Xfile g:readFile = 1
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
627 | g:readExtra = 2
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
628 g:readFile = 0
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
629 g:readExtra = 0
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
630 edit Xfile
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
631 assert_equal(1, g:readFile)
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
632 assert_equal(2, g:readExtra)
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
633 bwipe!
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
634 au! BufNewFile
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
635
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
636 au BufNewFile Xfile g:readFile = 1
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
637 | g:readExtra = 2
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
638 | g:readMore = 3
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
639 g:readFile = 0
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
640 g:readExtra = 0
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
641 g:readMore = 0
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
642 edit Xfile
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
643 assert_equal(1, g:readFile)
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
644 assert_equal(2, g:readExtra)
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
645 assert_equal(3, g:readMore)
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
646 bwipe!
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
647 au! BufNewFile
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
648 unlet g:readFile
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
649 unlet g:readExtra
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
650 unlet g:readMore
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
651 END
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
652 CheckDefAndScriptSuccess(lines)
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
653 enddef
40f824f5c7c7 patch 8.2.2242: Vim9: bar line continuation does not work at script level
Bram Moolenaar <Bram@vim.org>
parents: 23392
diff changeset
654
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
655 def Test_command_modifier_other()
22814
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
656 new Xsomefile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
657 setline(1, 'changed')
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
658 var buf = bufnr()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
659 hide edit Xotherfile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
660 var info = getbufinfo(buf)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
661 assert_equal(1, info[0].hidden)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
662 assert_equal(1, info[0].changed)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
663 edit Xsomefile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
664 bwipe!
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
665
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
666 au BufNewFile Xfile g:readFile = 1
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
667 g:readFile = 0
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
668 edit Xfile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
669 assert_equal(1, g:readFile)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
670 bwipe!
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
671 g:readFile = 0
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
672 noautocmd edit Xfile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
673 assert_equal(0, g:readFile)
23392
517fca70e084 patch 8.2.2239: Vim9: concatenating lines with backslash is inconvenient
Bram Moolenaar <Bram@vim.org>
parents: 23374
diff changeset
674 au! BufNewFile
517fca70e084 patch 8.2.2239: Vim9: concatenating lines with backslash is inconvenient
Bram Moolenaar <Bram@vim.org>
parents: 23374
diff changeset
675 unlet g:readFile
22814
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
676
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
677 noswapfile edit XnoSwap
23422
bb0c53f4ef8b patch 8.2.2254: Vim9: bool option type is number
Bram Moolenaar <Bram@vim.org>
parents: 23398
diff changeset
678 assert_equal(false, &l:swapfile)
22814
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
679 bwipe!
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
680
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
681 var caught = false
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
682 try
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
683 sandbox !ls
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
684 catch /E48:/
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
685 caught = true
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
686 endtry
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
687 assert_true(caught)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
688
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
689 :8verbose g:verbose_now = &verbose
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
690 assert_equal(8, g:verbose_now)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
691 unlet g:verbose_now
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
692 enddef
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
693
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
694 def EchoHere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
695 echomsg 'here'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
696 enddef
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
697 def EchoThere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
698 unsilent echomsg 'there'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
699 enddef
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
700
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
701 def Test_modifier_silent_unsilent()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
702 echomsg 'last one'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
703 silent echomsg "text"
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
704 assert_equal("\nlast one", execute(':1messages'))
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
705
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
706 silent! echoerr "error"
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
707
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
708 echomsg 'last one'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
709 silent EchoHere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
710 assert_equal("\nlast one", execute(':1messages'))
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
711
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
712 silent EchoThere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
713 assert_equal("\nthere", execute(':1messages'))
23348
456d625bb8c1 patch 8.2.2217: Vim9: command modifiers not restored in catch block
Bram Moolenaar <Bram@vim.org>
parents: 23346
diff changeset
714
456d625bb8c1 patch 8.2.2217: Vim9: command modifiers not restored in catch block
Bram Moolenaar <Bram@vim.org>
parents: 23346
diff changeset
715 try
456d625bb8c1 patch 8.2.2217: Vim9: command modifiers not restored in catch block
Bram Moolenaar <Bram@vim.org>
parents: 23346
diff changeset
716 silent eval [][0]
456d625bb8c1 patch 8.2.2217: Vim9: command modifiers not restored in catch block
Bram Moolenaar <Bram@vim.org>
parents: 23346
diff changeset
717 catch
456d625bb8c1 patch 8.2.2217: Vim9: command modifiers not restored in catch block
Bram Moolenaar <Bram@vim.org>
parents: 23346
diff changeset
718 echomsg "caught"
456d625bb8c1 patch 8.2.2217: Vim9: command modifiers not restored in catch block
Bram Moolenaar <Bram@vim.org>
parents: 23346
diff changeset
719 endtry
456d625bb8c1 patch 8.2.2217: Vim9: command modifiers not restored in catch block
Bram Moolenaar <Bram@vim.org>
parents: 23346
diff changeset
720 assert_equal("\ncaught", execute(':1messages'))
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
721 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
722
22790
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
723 def Test_range_after_command_modifier()
23346
2060f53b7c17 patch 8.2.2216: Vim9: range with missing colon can be hard to spot
Bram Moolenaar <Bram@vim.org>
parents: 23344
diff changeset
724 CheckScriptFailure(['vim9script', 'silent keepjump 1d _'], 'E1050: Colon required before a range: 1d _', 2)
22790
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
725 new
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
726 setline(1, 'xxx')
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
727 CheckScriptSuccess(['vim9script', 'silent keepjump :1d _'])
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
728 assert_equal('', getline(1))
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
729 bwipe!
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
730 enddef
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
731
23541
a2a38bc68dd9 patch 8.2.2313: Vim9: using uninitialized field when parsing range
Bram Moolenaar <Bram@vim.org>
parents: 23521
diff changeset
732 def Test_silent_pattern()
a2a38bc68dd9 patch 8.2.2313: Vim9: using uninitialized field when parsing range
Bram Moolenaar <Bram@vim.org>
parents: 23521
diff changeset
733 new
a2a38bc68dd9 patch 8.2.2313: Vim9: using uninitialized field when parsing range
Bram Moolenaar <Bram@vim.org>
parents: 23521
diff changeset
734 silent! :/pat/put _
a2a38bc68dd9 patch 8.2.2313: Vim9: using uninitialized field when parsing range
Bram Moolenaar <Bram@vim.org>
parents: 23521
diff changeset
735 bwipe!
a2a38bc68dd9 patch 8.2.2313: Vim9: using uninitialized field when parsing range
Bram Moolenaar <Bram@vim.org>
parents: 23521
diff changeset
736 enddef
a2a38bc68dd9 patch 8.2.2313: Vim9: using uninitialized field when parsing range
Bram Moolenaar <Bram@vim.org>
parents: 23521
diff changeset
737
21196
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
738 def Test_eval_command()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
739 var from = 3
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
740 var to = 5
21196
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
741 g:val = 111
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
742 def Increment(nrs: list<number>)
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
743 for nr in nrs
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
744 g:val += nr
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
745 endfor
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
746 enddef
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
747 eval range(from, to)
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
748 ->Increment()
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
749 assert_equal(111 + 3 + 4 + 5, g:val)
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
750 unlet g:val
23096
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
751
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
752 var lines =<< trim END
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
753 vim9script
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
754 g:caught = 'no'
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
755 try
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
756 eval 123 || 0
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
757 catch
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
758 g:caught = 'yes'
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
759 endtry
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
760 assert_equal('yes', g:caught)
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
761 unlet g:caught
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
762 END
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
763 CheckScriptSuccess(lines)
21196
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
764 enddef
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
765
21893
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
766 def Test_map_command()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
767 var lines =<< trim END
21893
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
768 nnoremap <F3> :echo 'hit F3 #'<CR>
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
769 assert_equal(":echo 'hit F3 #'<CR>", maparg("<F3>", "n"))
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
770 END
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
771 CheckDefSuccess(lines)
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
772 CheckScriptSuccess(['vim9script'] + lines)
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
773 enddef
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
774
21941
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
775 def Test_normal_command()
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
776 new
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
777 setline(1, 'doesnotexist')
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
778 var caught = 0
21941
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
779 try
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
780 exe "norm! \<C-]>"
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
781 catch /E433/
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
782 caught = 2
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
783 endtry
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
784 assert_equal(2, caught)
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
785
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
786 try
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
787 exe "norm! 3\<C-]>"
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
788 catch /E433/
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
789 caught = 3
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
790 endtry
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
791 assert_equal(3, caught)
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
792 bwipe!
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
793 enddef
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
794
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
795 def Test_put_command()
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
796 new
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
797 @p = 'ppp'
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
798 put p
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
799 assert_equal('ppp', getline(2))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
800
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
801 put ='below'
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
802 assert_equal('below', getline(3))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
803 put! ='above'
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
804 assert_equal('above', getline(3))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
805 assert_equal('below', getline(4))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
806
23628
b26bbc03126a patch 8.2.2356: Vim9: ":put =expr" does not handle a list properly
Bram Moolenaar <Bram@vim.org>
parents: 23580
diff changeset
807 :2put =['a', 'b', 'c']
b26bbc03126a patch 8.2.2356: Vim9: ":put =expr" does not handle a list properly
Bram Moolenaar <Bram@vim.org>
parents: 23580
diff changeset
808 assert_equal(['ppp', 'a', 'b', 'c', 'above'], getline(2, 6))
b26bbc03126a patch 8.2.2356: Vim9: ":put =expr" does not handle a list properly
Bram Moolenaar <Bram@vim.org>
parents: 23580
diff changeset
809
23156
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
810 # compute range at runtime
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
811 setline(1, range(1, 8))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
812 @a = 'aaa'
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
813 :$-2put a
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
814 assert_equal('aaa', getline(7))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
815
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
816 setline(1, range(1, 8))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
817 :2
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
818 :+2put! a
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
819 assert_equal('aaa', getline(4))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
820
23671
9ee9c4246a7f patch 8.2.2377: Vim9: crash when using a range after another expression
Bram Moolenaar <Bram@vim.org>
parents: 23628
diff changeset
821 []->mapnew(() => 0)
9ee9c4246a7f patch 8.2.2377: Vim9: crash when using a range after another expression
Bram Moolenaar <Bram@vim.org>
parents: 23628
diff changeset
822 :$put ='end'
9ee9c4246a7f patch 8.2.2377: Vim9: crash when using a range after another expression
Bram Moolenaar <Bram@vim.org>
parents: 23628
diff changeset
823 assert_equal('end', getline('$'))
9ee9c4246a7f patch 8.2.2377: Vim9: crash when using a range after another expression
Bram Moolenaar <Bram@vim.org>
parents: 23628
diff changeset
824
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
825 bwipe!
23197
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
826
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
827 CheckDefFailure(['put =xxx'], 'E1001:')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
828 enddef
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
829
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
830 def Test_put_with_linebreak()
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
831 new
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
832 var lines =<< trim END
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
833 vim9script
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
834 pu =split('abc', '\zs')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
835 ->join()
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
836 END
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
837 CheckScriptSuccess(lines)
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
838 getline(2)->assert_equal('a b c')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
839 bwipe!
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
840 enddef
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
841
22260
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
842 def Test_command_star_range()
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
843 new
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
844 setline(1, ['xxx foo xxx', 'xxx bar xxx', 'xxx foo xx bar'])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
845 setpos("'<", [0, 1, 0, 0])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
846 setpos("'>", [0, 3, 0, 0])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
847 :*s/\(foo\|bar\)/baz/g
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
848 getline(1, 3)->assert_equal(['xxx baz xxx', 'xxx baz xxx', 'xxx baz xx baz'])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
849
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
850 bwipe!
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
851 enddef
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
852
22649
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
853 def Test_f_args()
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
854 var lines =<< trim END
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
855 vim9script
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
856
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
857 func SaveCmdArgs(...)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
858 let g:args = a:000
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
859 endfunc
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
860
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
861 command -nargs=* TestFArgs call SaveCmdArgs(<f-args>)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
862
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
863 TestFArgs
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
864 assert_equal([], g:args)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
865
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
866 TestFArgs one two three
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
867 assert_equal(['one', 'two', 'three'], g:args)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
868 END
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
869 CheckScriptSuccess(lines)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
870 enddef
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
871
23513
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
872 def Test_user_command_comment()
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
873 command -nargs=1 Comd echom <q-args>
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
874
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
875 var lines =<< trim END
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
876 vim9script
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
877 Comd # comment
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
878 END
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
879 CheckScriptSuccess(lines)
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
880
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
881 lines =<< trim END
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
882 vim9script
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
883 Comd# comment
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
884 END
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
885 CheckScriptFailure(lines, 'E1144:')
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
886
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
887 delcommand Comd
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
888 enddef
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
889
22950
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
890 def Test_star_command()
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
891 var lines =<< trim END
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
892 vim9script
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
893 @s = 'g:success = 8'
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
894 set cpo+=*
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
895 exe '*s'
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
896 assert_equal(8, g:success)
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
897 unlet g:success
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
898 set cpo-=*
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
899 assert_fails("exe '*s'", 'E1050:')
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
900 END
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
901 CheckScriptSuccess(lines)
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
902 enddef
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
903
23011
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
904 def Test_cmd_argument_without_colon()
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
905 new Xfile
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
906 setline(1, ['a', 'b', 'c', 'd'])
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
907 write
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
908 edit +3 %
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
909 assert_equal(3, getcurpos()[1])
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
910 edit +/a %
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
911 assert_equal(1, getcurpos()[1])
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
912 bwipe
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
913 delete('Xfile')
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
914 enddef
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
915
23205
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
916 def Test_ambiguous_user_cmd()
23513
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
917 command Cmd1 eval 0
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
918 command Cmd2 eval 0
23205
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
919 var lines =<< trim END
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
920 Cmd
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
921 END
23513
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
922 CheckDefAndScriptFailure(lines, 'E464:', 1)
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
923 delcommand Cmd1
872239543313 patch 8.2.2299: Vim9: invalid memory access making error message flaky
Bram Moolenaar <Bram@vim.org>
parents: 23477
diff changeset
924 delcommand Cmd2
23205
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
925 enddef
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
926
23254
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
927 def Test_command_not_recognized()
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
928 var lines =<< trim END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
929 d.key = 'asdf'
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
930 END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
931 CheckDefFailure(lines, 'E1146:', 1)
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
932
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
933 lines =<< trim END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
934 d['key'] = 'asdf'
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
935 END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
936 CheckDefFailure(lines, 'E1146:', 1)
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
937 enddef
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
938
23272
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
939 def Test_magic_not_used()
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
940 new
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
941 for cmd in ['set magic', 'set nomagic']
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
942 exe cmd
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
943 setline(1, 'aaa')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
944 s/.../bbb/
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
945 assert_equal('bbb', getline(1))
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
946 endfor
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
947
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
948 set magic
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
949 setline(1, 'aaa')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
950 assert_fails('s/.\M../bbb/', 'E486:')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
951 assert_fails('snomagic/.../bbb/', 'E486:')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
952 assert_equal('aaa', getline(1))
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
953
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
954 bwipe!
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
955 enddef
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
956
23274
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
957 def Test_gdefault_not_used()
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
958 new
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
959 for cmd in ['set gdefault', 'set nogdefault']
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
960 exe cmd
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
961 setline(1, 'aaa')
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
962 s/./b/
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
963 assert_equal('baa', getline(1))
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
964 endfor
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
965
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
966 set nogdefault
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
967 bwipe!
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
968 enddef
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
969
23374
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
970 def g:SomeComplFunc(findstart: number, base: string): any
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
971 if findstart
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
972 return 0
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
973 else
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
974 return ['aaa', 'bbb']
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
975 endif
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
976 enddef
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
977
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
978 def Test_insert_complete()
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
979 # this was running into an error with the matchparen hack
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
980 new
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
981 set completefunc=SomeComplFunc
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
982 feedkeys("i\<c-x>\<c-u>\<Esc>", 'ntx')
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
983 assert_equal('aaa', getline(1))
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
984
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
985 set completefunc=
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
986 bwipe!
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
987 enddef
1371e21fdc3d patch 8.2.2230: Vim9: insert completion runs into error
Bram Moolenaar <Bram@vim.org>
parents: 23370
diff changeset
988
23477
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
989 def Test_wincmd()
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
990 split
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
991 var id1 = win_getid()
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
992 if true
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
993 try | wincmd w | catch | endtry
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
994 endif
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
995 assert_notequal(id1, win_getid())
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
996 close
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
997 enddef
95db03521b01 patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
998
23580
dc3b7a31c29f patch 8.2.2332: Vim9: missing :endif not reported when using :windo
Bram Moolenaar <Bram@vim.org>
parents: 23541
diff changeset
999 def Test_windo_missing_endif()
dc3b7a31c29f patch 8.2.2332: Vim9: missing :endif not reported when using :windo
Bram Moolenaar <Bram@vim.org>
parents: 23541
diff changeset
1000 var lines =<< trim END
dc3b7a31c29f patch 8.2.2332: Vim9: missing :endif not reported when using :windo
Bram Moolenaar <Bram@vim.org>
parents: 23541
diff changeset
1001 windo if 1
dc3b7a31c29f patch 8.2.2332: Vim9: missing :endif not reported when using :windo
Bram Moolenaar <Bram@vim.org>
parents: 23541
diff changeset
1002 END
dc3b7a31c29f patch 8.2.2332: Vim9: missing :endif not reported when using :windo
Bram Moolenaar <Bram@vim.org>
parents: 23541
diff changeset
1003 CheckDefExecFailure(lines, 'E171:', 1)
dc3b7a31c29f patch 8.2.2332: Vim9: missing :endif not reported when using :windo
Bram Moolenaar <Bram@vim.org>
parents: 23541
diff changeset
1004 enddef
dc3b7a31c29f patch 8.2.2332: Vim9: missing :endif not reported when using :windo
Bram Moolenaar <Bram@vim.org>
parents: 23541
diff changeset
1005
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1006 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker