Mercurial > vim
annotate src/testdir/test_vim9_cmd.vim @ 21122:839ace6773aa v8.2.1112
patch 8.2.1112: Vim9: no line continuation allowed in method call
Commit: https://github.com/vim/vim/commit/5f195938d4d489aa288bdb54ee6112a34aed1df9
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 1 20:07:14 2020 +0200
patch 8.2.1112: Vim9: no line continuation allowed in method call
Problem: Vim9: no line continuation allowed in method call.
Solution: Handle line continuation in expression before method call.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 01 Jul 2020 20:15:03 +0200 |
parents | 111f877e63d9 |
children | 4a1e8086759b |
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 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 def Test_edit_wildcards() |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 let filename = 'Xtest' |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 edit `=filename` |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 assert_equal('Xtest', bufname()) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 let filenr = 123 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 edit Xtest`=filenr` |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 assert_equal('Xtest123', bufname()) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 filenr = 77 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 edit `=filename``=filenr` |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 assert_equal('Xtest77', bufname()) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 edit X`=filename`xx`=filenr`yy |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 assert_equal('XXtestxx77yy', bufname()) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 enddef |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 |
20172
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
23 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
|
24 CheckUnix |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
25 CheckFeature postscript |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
26 |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
27 let outfile = 'print' |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
28 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
|
29 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
|
30 |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
31 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
|
32 enddef |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
33 |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
34 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
|
35 writefile(['syn keyword Found found'], 'Xthemine.vim') |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
36 let save_rtp = &rtp |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
37 &rtp = '.' |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
38 |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
39 let fname = 'mine' |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
40 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
|
41 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
|
42 |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
43 &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
|
44 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
|
45 enddef |
1d84eaed0ec8
patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
46 |
20349
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
47 def Test_assign_list() |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
48 let l: list<string> = [] |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
49 l[0] = 'value' |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
50 assert_equal('value', l[0]) |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
51 |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
52 l[1] = 'asdf' |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
53 assert_equal('value', l[0]) |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
54 assert_equal('asdf', l[1]) |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
55 assert_equal('asdf', l[-1]) |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
56 assert_equal('value', l[-2]) |
20353
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
57 |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
58 let nrl: list<number> = [] |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
59 for i in range(5) |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
60 nrl[i] = i |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
61 endfor |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
62 assert_equal([0, 1, 2, 3, 4], nrl) |
20349
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
63 enddef |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
64 |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
65 def Test_assign_dict() |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
66 let d: dict<string> = {} |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
67 d['key'] = 'value' |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
68 assert_equal('value', d['key']) |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
69 |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
70 d[123] = 'qwerty' |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
71 assert_equal('qwerty', d[123]) |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
72 assert_equal('qwerty', d['123']) |
20353
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
73 |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
74 let nrd: dict<number> = {} |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
75 for i in range(3) |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
76 nrd[i] = i |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
77 endfor |
a8a76fd967ab
patch 8.2.0732: Vim9: storing value in dict messes up stack
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
78 assert_equal({'0': 0, '1': 1, '2': 2}, nrd) |
20349
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
79 enddef |
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20172
diff
changeset
|
80 |
21048
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
81 def Test_echo_linebreak() |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
82 let 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
|
83 vim9script |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
84 redir @a |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
85 echo 'one' |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
86 .. 'two' |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
87 redir END |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
88 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
|
89 END |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
90 CheckScriptSuccess(lines) |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
91 |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
92 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
|
93 vim9script |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
94 redir @a |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
95 echo 11 + |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
96 77 |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
97 - 22 |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
98 redir END |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
99 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
|
100 END |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
101 CheckScriptSuccess(lines) |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
102 enddef |
524fa1d42e1e
patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents:
20353
diff
changeset
|
103 |
21050
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
104 def Test_if_linebreak() |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
105 let 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
|
106 vim9script |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
107 if 1 && |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
108 2 |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
109 || 3 |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
110 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
|
111 endif |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
112 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
|
113 END |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
114 CheckScriptSuccess(lines) |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
115 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
|
116 |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
117 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
|
118 vim9script |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
119 if 1 && |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
120 0 |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
121 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
|
122 elseif 0 || |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
123 0 |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
124 || 1 |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
125 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
|
126 endif |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
127 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
|
128 END |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
129 CheckScriptSuccess(lines) |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
130 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
|
131 enddef |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
132 |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
133 def Test_while_linebreak() |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
134 let 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
|
135 vim9script |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
136 let 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
|
137 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
|
138 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
|
139 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
|
140 + 4 |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
141 endwhile |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
142 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
|
143 END |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
144 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
|
145 |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
146 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
|
147 vim9script |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
148 let nr = 0 |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
149 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
|
150 < |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
151 10 |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
152 + |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
153 3 |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
154 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
|
155 + |
a7c202f5cbe9
patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents:
21050
diff
changeset
|
156 4 |
21050
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
157 endwhile |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
158 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
|
159 END |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
160 CheckScriptSuccess(lines) |
7a9daf73a724
patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents:
21048
diff
changeset
|
161 enddef |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 |
21058
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
163 def Test_for_linebreak() |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
164 let 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
|
165 vim9script |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
166 let nr = 0 |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
167 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
|
168 in |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
169 [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
|
170 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
|
171 endfor |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
172 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
|
173 END |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
174 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
|
175 |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
176 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
|
177 vim9script |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
178 let nr = 0 |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
179 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
|
180 in |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
181 [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
|
182 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
|
183 ] |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
184 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
|
185 + |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
186 x |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
187 endfor |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
188 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
|
189 END |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
190 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
|
191 enddef |
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
192 |
21122
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
193 def Test_method_cal_linebreak() |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
194 let lines =<< trim END |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
195 vim9script |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
196 let res = [] |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
197 func RetArg( |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
198 arg |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
199 ) |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
200 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
|
201 endfunc |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
202 [1, |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
203 2, |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
204 3]->RetArg() |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
205 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
|
206 END |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
207 CheckScriptSuccess(lines) |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
208 enddef |
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21058
diff
changeset
|
209 |
21058
111f877e63d9
patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents:
21056
diff
changeset
|
210 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |