Mercurial > vim
annotate src/testdir/test_vim9_expr.vim @ 21646:a640bc762196 v8.2.1373
patch 8.2.1373: Vim9: no error for assigning to non-existing script var
Commit: https://github.com/vim/vim/commit/f9b2b49663226235f94f08230fe9023caf80a6e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 5 14:34:14 2020 +0200
patch 8.2.1373: Vim9: no error for assigning to non-existing script var
Problem: Vim9: no error for assigning to non-existing script var.
Solution: Check that in Vim9 script the variable was defined. (closes https://github.com/vim/vim/issues/6630)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 05 Aug 2020 14:45:03 +0200 |
parents | 7d3ba70a03f1 |
children | 79a8d723a3d2 |
rev | line source |
---|---|
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Tests for Vim9 script expressions |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 source check.vim |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
4 source vim9.vim |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 |
21421
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
6 |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
7 let g:cond = v:false |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
8 def FuncOne(arg: number): string |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
9 return 'yes' |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
10 enddef |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
11 def FuncTwo(arg: number): number |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
12 return 123 |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
13 enddef |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
14 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 " test cond ? expr : expr |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 def Test_expr1() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 assert_equal('one', true ? 'one' : 'two') |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
18 assert_equal('one', 1 ? |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
19 'one' : |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
20 'two') |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19219
diff
changeset
|
21 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19219
diff
changeset
|
22 assert_equal('one', 0.1 ? 'one' : 'two') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19219
diff
changeset
|
23 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 assert_equal('one', 'x' ? 'one' : 'two') |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
25 assert_equal('one', 'x' |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
26 ? 'one' |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
27 : 'two') |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
28 assert_equal('one', 0z1234 ? 'one' : 'two') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 assert_equal('one', [0] ? 'one' : 'two') |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
30 assert_equal('one', #{x: 0} ? 'one' : 'two') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 let var = 1 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 assert_equal('one', var ? 'one' : 'two') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 assert_equal('two', false ? 'one' : 'two') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 assert_equal('two', 0 ? 'one' : 'two') |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
36 if has('float') |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
37 assert_equal('two', 0.0 ? 'one' : 'two') |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
38 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 assert_equal('two', '' ? 'one' : 'two') |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
40 assert_equal('two', 0z ? 'one' : 'two') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 assert_equal('two', [] ? 'one' : 'two') |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
42 assert_equal('two', {} ? 'one' : 'two') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 var = 0 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 assert_equal('two', var ? 'one' : 'two') |
20207
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
45 |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
46 let Some: func = function('len') |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
47 let Other: func = function('winnr') |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
48 let Res: func = g:atrue ? Some : Other |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
49 assert_equal(function('len'), Res) |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
50 |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
51 let RetOne: func(string): number = function('len') |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
52 let RetTwo: func(string): number = function('winnr') |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
53 let RetThat: func = g:atrue ? RetOne : RetTwo |
3c247d9cd6f9
patch 8.2.0659: Vim9: no test for equal func type
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
54 assert_equal(function('len'), RetThat) |
21421
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
55 |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
56 let x = FuncOne |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
57 let y = FuncTwo |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
58 let Z = g:cond ? FuncOne : FuncTwo |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
59 assert_equal(123, Z(3)) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 |
21022
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
62 def Test_expr1_vimscript() |
21644
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
63 # check line continuation |
21022
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
64 let lines =<< trim END |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
65 vim9script |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
66 let var = 1 |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
67 ? 'yes' |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
68 : 'no' |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
69 assert_equal('yes', var) |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
70 END |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
71 CheckScriptSuccess(lines) |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
72 |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
73 lines =<< trim END |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
74 vim9script |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
75 let var = v:false |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
76 ? 'yes' |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
77 : 'no' |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
78 assert_equal('no', var) |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
79 END |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
80 CheckScriptSuccess(lines) |
21046
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
81 |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
82 lines =<< trim END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
83 vim9script |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
84 let var = v:false ? |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
85 'yes' : |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
86 'no' |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
87 assert_equal('no', var) |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
88 END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
89 CheckScriptSuccess(lines) |
21644
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
90 |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
91 # check white space |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
92 lines =<< trim END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
93 vim9script |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
94 let var = v:true?1:2 |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
95 END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
96 CheckScriptFailure(lines, 'E1004:') |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
97 lines =<< trim END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
98 vim9script |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
99 let var = v:true? 1 : 2 |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
100 END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
101 CheckScriptFailure(lines, 'E1004:') |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
102 lines =<< trim END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
103 vim9script |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
104 let var = v:true ?1 : 2 |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
105 END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
106 CheckScriptFailure(lines, 'E1004:') |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
107 lines =<< trim END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
108 vim9script |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
109 let var = v:true ? 1: 2 |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
110 END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
111 CheckScriptFailure(lines, 'E1004:') |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
112 lines =<< trim END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
113 vim9script |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
114 let var = v:true ? 1 :2 |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
115 END |
7d3ba70a03f1
patch 8.2.1372: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21642
diff
changeset
|
116 CheckScriptFailure(lines, 'E1004:') |
21022
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
117 enddef |
9d8634e91d1b
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Bram Moolenaar <Bram@vim.org>
parents:
20992
diff
changeset
|
118 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 func Test_expr1_fails() |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
120 call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'") |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
121 call CheckDefFailure(["let x = 1 ? 'one' : xxx"], "E1001:") |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 let msg = "white space required before and after '?'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
124 call CheckDefFailure(["let x = 1? 'one' : 'two'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
125 call CheckDefFailure(["let x = 1 ?'one' : 'two'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
126 call CheckDefFailure(["let x = 1?'one' : 'two'"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 let msg = "white space required before and after ':'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
129 call CheckDefFailure(["let x = 1 ? 'one': 'two'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
130 call CheckDefFailure(["let x = 1 ? 'one' :'two'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
131 call CheckDefFailure(["let x = 1 ? 'one':'two'"], msg) |
21421
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
132 |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
133 " missing argument detected even when common type is used |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
134 call CheckDefFailure([ |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
135 \ 'let x = FuncOne', |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
136 \ 'let y = FuncTwo', |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
137 \ 'let Z = g:cond ? FuncOne : FuncTwo', |
0f0fee4122d3
patch 8.2.1261: Vim9: common type of function not tested
Bram Moolenaar <Bram@vim.org>
parents:
21411
diff
changeset
|
138 \ 'Z()'], 'E119:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 " TODO: define inside test function |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 def Record(val: any): any |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 g:vals->add(val) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 return val |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 " test || |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 def Test_expr2() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 assert_equal(2, 2 || 0) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
150 assert_equal(7, 0 || |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
151 0 || |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
152 7) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 assert_equal(0, 0 || 0) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
154 assert_equal(0, 0 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
155 || 0) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 assert_equal('', 0 || '') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 assert_equal(3, Record(3) || Record(1)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 assert_equal([3], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 assert_equal(5, Record(0) || Record(5)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 assert_equal([0, 5], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 g:vals = [] |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
167 assert_equal(4, Record(0) |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
168 || Record(4) |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
169 || Record(0)) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 assert_equal([0, 4], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 assert_equal(0, Record([]) || Record('') || Record(0)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 assert_equal([[], '', 0], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
177 def Test_expr2_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
178 # check line continuation |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
179 let lines =<< trim END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
180 vim9script |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
181 let var = 0 |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
182 || 1 |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
183 assert_equal(1, var) |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
184 END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
185 CheckScriptSuccess(lines) |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
186 |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
187 lines =<< trim END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
188 vim9script |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
189 let var = v:false |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
190 || v:true |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
191 || v:false |
21309
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
192 assert_equal(v:true, var) |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
193 END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
194 CheckScriptSuccess(lines) |
21046
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
195 |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
196 lines =<< trim END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
197 vim9script |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
198 let var = v:false || |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
199 v:true || |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
200 v:false |
21309
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
201 assert_equal(v:true, var) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
202 END |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
203 CheckScriptSuccess(lines) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
204 |
21642
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
205 # check white space |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
206 lines =<< trim END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
207 vim9script |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
208 let var = v:true||v:true |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
209 END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
210 CheckScriptFailure(lines, 'E1004:') |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
211 lines =<< trim END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
212 vim9script |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
213 let var = v:true ||v:true |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
214 END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
215 CheckScriptFailure(lines, 'E1004:') |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
216 lines =<< trim END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
217 vim9script |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
218 let var = v:true|| v:true |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
219 END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
220 CheckScriptFailure(lines, 'E1004:') |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
221 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
222 # check keeping the value |
21309
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
223 lines =<< trim END |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
224 vim9script |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
225 assert_equal(2, 2 || 0) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
226 assert_equal(7, 0 || |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
227 0 || |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
228 7) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
229 assert_equal(0, 0 || 0) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
230 assert_equal(0, 0 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
231 || 0) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
232 assert_equal('', 0 || '') |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
233 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
234 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
235 assert_equal(3, Record(3) || Record(1)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
236 assert_equal([3], g:vals) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
237 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
238 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
239 assert_equal(5, Record(0) || Record(5)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
240 assert_equal([0, 5], g:vals) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
241 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
242 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
243 assert_equal(4, Record(0) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
244 || Record(4) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
245 || Record(0)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
246 assert_equal([0, 4], g:vals) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
247 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
248 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
249 assert_equal(0, Record([]) || Record('') || Record(0)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
250 assert_equal([[], '', 0], g:vals) |
21046
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
251 END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
252 CheckScriptSuccess(lines) |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
253 enddef |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
254 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 func Test_expr2_fails() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 let msg = "white space required before and after '||'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
257 call CheckDefFailure(["let x = 1||2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
258 call CheckDefFailure(["let x = 1 ||2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
259 call CheckDefFailure(["let x = 1|| 2"], msg) |
19872
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19860
diff
changeset
|
260 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
261 call CheckDefFailure(["let x = 1 || xxx"], 'E1001:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 " test && |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 def Test_expr3() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 assert_equal(0, 2 && 0) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
267 assert_equal(0, 0 && |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
268 0 && |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
269 7) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
270 assert_equal(7, 2 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
271 && 3 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
272 && 7) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 assert_equal(0, 0 && 0) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 assert_equal(0, 0 && '') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 assert_equal('', 8 && '') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 assert_equal(1, Record(3) && Record(1)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 assert_equal([3, 1], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 assert_equal(0, Record(0) && Record(5)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 assert_equal([0], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 assert_equal(0, Record(0) && Record(4) && Record(0)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 assert_equal([0], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 assert_equal(0, Record(8) && Record(4) && Record(0)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 assert_equal([8, 4, 0], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 g:vals = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 assert_equal(0, Record([1]) && Record('z') && Record(0)) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 assert_equal([[1], 'z', 0], g:vals) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
298 def Test_expr3_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
299 # check line continuation |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
300 let lines =<< trim END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
301 vim9script |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
302 let var = 0 |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
303 && 1 |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
304 assert_equal(0, var) |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
305 END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
306 CheckScriptSuccess(lines) |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
307 |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
308 lines =<< trim END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
309 vim9script |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
310 let var = v:true |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
311 && v:true |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
312 && v:true |
21309
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
313 assert_equal(v:true, var) |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
314 END |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
315 CheckScriptSuccess(lines) |
21046
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
316 |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
317 lines =<< trim END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
318 vim9script |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
319 let var = v:true && |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
320 v:true && |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
321 v:true |
21309
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
322 assert_equal(v:true, var) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
323 END |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
324 CheckScriptSuccess(lines) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
325 |
21642
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
326 # check white space |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
327 lines =<< trim END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
328 vim9script |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
329 let var = v:true&&v:true |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
330 END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
331 CheckScriptFailure(lines, 'E1004:') |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
332 lines =<< trim END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
333 vim9script |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
334 let var = v:true &&v:true |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
335 END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
336 CheckScriptFailure(lines, 'E1004:') |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
337 lines =<< trim END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
338 vim9script |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
339 let var = v:true&& v:true |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
340 END |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
341 CheckScriptFailure(lines, 'E1004:') |
5ae89c8633ae
patch 8.2.1371: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21636
diff
changeset
|
342 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
343 # check keeping the value |
21309
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
344 lines =<< trim END |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
345 vim9script |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
346 assert_equal(0, 2 && 0) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
347 assert_equal(0, 0 && |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
348 0 && |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
349 7) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
350 assert_equal(7, 2 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
351 && 3 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
352 && 7) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
353 assert_equal(0, 0 && 0) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
354 assert_equal(0, 0 && '') |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
355 assert_equal('', 8 && '') |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
356 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
357 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
358 assert_equal(1, Record(3) && Record(1)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
359 assert_equal([3, 1], g:vals) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
360 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
361 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
362 assert_equal(0, Record(0) && Record(5)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
363 assert_equal([0], g:vals) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
364 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
365 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
366 assert_equal(0, Record(0) && Record(4) && Record(0)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
367 assert_equal([0], g:vals) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
368 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
369 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
370 assert_equal(0, Record(8) && Record(4) && Record(0)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
371 assert_equal([8, 4, 0], g:vals) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
372 |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
373 g:vals = [] |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
374 assert_equal(0, Record([1]) && Record('z') && Record(0)) |
31a3f4d408b9
patch 8.2.1205: Vim9: && and || work different when not compiled
Bram Moolenaar <Bram@vim.org>
parents:
21307
diff
changeset
|
375 assert_equal([[1], 'z', 0], g:vals) |
21046
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
376 END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
377 CheckScriptSuccess(lines) |
21024
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
378 enddef |
02b03915855d
patch 8.2.1063: Vim9: no line break allowed before || or &&
Bram Moolenaar <Bram@vim.org>
parents:
21022
diff
changeset
|
379 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 func Test_expr3_fails() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 let msg = "white space required before and after '&&'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
382 call CheckDefFailure(["let x = 1&&2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
383 call CheckDefFailure(["let x = 1 &&2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
384 call CheckDefFailure(["let x = 1&& 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 let atrue = v:true |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 let afalse = v:false |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 let anone = v:none |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 let anull = v:null |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
391 let anint = 10 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 let alsoint = 4 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 if has('float') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 let afloat = 0.1 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 endif |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 let astring = 'asdf' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 let ablob = 0z01ab |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 let alist = [2, 3, 4] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 let adict = #{aaa: 2, bbb: 8} |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 " test == comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 def Test_expr4_equal() |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
403 let trueVar = true |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
404 let falseVar = false |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 assert_equal(true, true == true) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
406 assert_equal(false, true == |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
407 false) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
408 assert_equal(true, true |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
409 == trueVar) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
410 assert_equal(false, true == falseVar) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 assert_equal(true, true == g:atrue) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 assert_equal(false, g:atrue == false) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
413 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 assert_equal(true, v:none == v:none) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 assert_equal(false, v:none == v:null) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 assert_equal(true, g:anone == v:none) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 assert_equal(false, v:none == g:anull) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
419 let nr0 = 0 |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
420 let nr61 = 61 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 assert_equal(false, 2 == 0) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
422 assert_equal(false, 2 == nr0) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
423 assert_equal(true, 61 == 61) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
424 assert_equal(true, 61 == nr61) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 assert_equal(true, g:anint == 10) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 assert_equal(false, 61 == g:anint) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 if has('float') |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
429 let ff = 0.3 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
430 assert_equal(true, ff == 0.3) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
431 assert_equal(false, 0.4 == ff) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 assert_equal(true, 0.1 == g:afloat) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 assert_equal(false, g:afloat == 0.3) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
435 ff = 3.0 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
436 assert_equal(true, ff == 3) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
437 assert_equal(true, 3 == ff) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
438 ff = 3.1 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
439 assert_equal(false, ff == 3) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
440 assert_equal(false, 3 == ff) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 endif |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 assert_equal(true, 'abc' == 'abc') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 assert_equal(false, 'xyz' == 'abc') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 assert_equal(true, g:astring == 'asdf') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 assert_equal(false, 'xyz' == g:astring) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19856
diff
changeset
|
448 assert_equal(false, 'abc' == 'aBc') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19856
diff
changeset
|
449 assert_equal(false, 'abc' ==# 'aBc') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19856
diff
changeset
|
450 assert_equal(true, 'abc' ==? 'aBc') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19856
diff
changeset
|
451 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 assert_equal(false, 'abc' == 'ABC') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 set ignorecase |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 assert_equal(false, 'abc' == 'ABC') |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19856
diff
changeset
|
455 assert_equal(false, 'abc' ==# 'ABC') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 set noignorecase |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
458 call CheckDefFailure(["let x = 'a' == xxx"], 'E1001:') |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19856
diff
changeset
|
459 |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
460 let bb = 0z3f |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
461 assert_equal(true, 0z3f == bb) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
462 assert_equal(false, bb == 0z4f) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 assert_equal(true, g:ablob == 0z01ab) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 assert_equal(false, 0z3f == g:ablob) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 assert_equal(true, [1, 2, 3] == [1, 2, 3]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 assert_equal(false, [1, 2, 3] == [2, 3, 1]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 assert_equal(true, [2, 3, 4] == g:alist) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 assert_equal(false, g:alist == [2, 3, 1]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 assert_equal(false, [1, 2, 3] == []) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 assert_equal(false, [1, 2, 3] == ['1', '2', '3']) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 assert_equal(true, #{one: 1, two: 2} == #{one: 1, two: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 assert_equal(false, #{one: 1, two: 2} == #{one: 2, two: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 assert_equal(false, #{one: 1, two: 2} == #{two: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 assert_equal(false, #{one: 1, two: 2} == #{}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 assert_equal(true, g:adict == #{bbb: 8, aaa: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 assert_equal(false, #{ccc: 9, aaa: 2} == g:adict) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
480 assert_equal(true, function('g:Test_expr4_equal') == function('g:Test_expr4_equal')) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
481 assert_equal(false, function('g:Test_expr4_equal') == function('g:Test_expr4_is')) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
483 assert_equal(true, function('g:Test_expr4_equal', [123]) == function('g:Test_expr4_equal', [123])) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
484 assert_equal(false, function('g:Test_expr4_equal', [123]) == function('g:Test_expr4_is', [123])) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
485 assert_equal(false, function('g:Test_expr4_equal', [123]) == function('g:Test_expr4_equal', [999])) |
20203
5a397db2c1ed
patch 8.2.0657: Vim9: no check if called variable is a FuncRef
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
486 |
5a397db2c1ed
patch 8.2.0657: Vim9: no check if called variable is a FuncRef
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
487 let OneFunc: func |
5a397db2c1ed
patch 8.2.0657: Vim9: no check if called variable is a FuncRef
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
488 let TwoFunc: func |
5a397db2c1ed
patch 8.2.0657: Vim9: no check if called variable is a FuncRef
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
489 OneFunc = function('len') |
5a397db2c1ed
patch 8.2.0657: Vim9: no check if called variable is a FuncRef
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
490 TwoFunc = function('len') |
5a397db2c1ed
patch 8.2.0657: Vim9: no check if called variable is a FuncRef
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
491 assert_equal(true, OneFunc('abc') == TwoFunc('123')) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
493 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 " test != comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 def Test_expr4_notequal() |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
496 let trueVar = true |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
497 let falseVar = false |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 assert_equal(false, true != true) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
499 assert_equal(true, true != |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
500 false) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
501 assert_equal(false, true |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
502 != trueVar) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
503 assert_equal(true, true != falseVar) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 assert_equal(false, true != g:atrue) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 assert_equal(true, g:atrue != false) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 assert_equal(false, v:none != v:none) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 assert_equal(true, v:none != v:null) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 assert_equal(false, g:anone != v:none) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 assert_equal(true, v:none != g:anull) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
512 let nr55 = 55 |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
513 let nr0 = 55 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 assert_equal(true, 2 != 0) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
515 assert_equal(true, 2 != nr0) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 assert_equal(false, 55 != 55) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
517 assert_equal(false, 55 != nr55) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 assert_equal(false, g:anint != 10) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 assert_equal(true, 61 != g:anint) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 if has('float') |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
522 let ff = 0.3 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
523 assert_equal(false, 0.3 != ff) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
524 assert_equal(true, 0.4 != ff) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 assert_equal(false, 0.1 != g:afloat) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 assert_equal(true, g:afloat != 0.3) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
528 ff = 3.0 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
529 assert_equal(false, ff != 3) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
530 assert_equal(false, 3 != ff) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
531 ff = 3.1 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
532 assert_equal(true, ff != 3) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
533 assert_equal(true, 3 != ff) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 endif |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
535 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 assert_equal(false, 'abc' != 'abc') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 assert_equal(true, 'xyz' != 'abc') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 assert_equal(false, g:astring != 'asdf') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 assert_equal(true, 'xyz' != g:astring) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 assert_equal(true, 'abc' != 'ABC') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 set ignorecase |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 assert_equal(true, 'abc' != 'ABC') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 set noignorecase |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
546 let bb = 0z3f |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
547 assert_equal(false, 0z3f != bb) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
548 assert_equal(true, bb != 0z4f) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 assert_equal(false, g:ablob != 0z01ab) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 assert_equal(true, 0z3f != g:ablob) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 assert_equal(false, [1, 2, 3] != [1, 2, 3]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 assert_equal(true, [1, 2, 3] != [2, 3, 1]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 assert_equal(false, [2, 3, 4] != g:alist) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 assert_equal(true, g:alist != [2, 3, 1]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 assert_equal(true, [1, 2, 3] != []) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 assert_equal(true, [1, 2, 3] != ['1', '2', '3']) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
558 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
559 assert_equal(false, #{one: 1, two: 2} != #{one: 1, two: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 assert_equal(true, #{one: 1, two: 2} != #{one: 2, two: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
561 assert_equal(true, #{one: 1, two: 2} != #{two: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
562 assert_equal(true, #{one: 1, two: 2} != #{}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
563 assert_equal(false, g:adict != #{bbb: 8, aaa: 2}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
564 assert_equal(true, #{ccc: 9, aaa: 2} != g:adict) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
565 |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
566 assert_equal(false, function('g:Test_expr4_equal') != function('g:Test_expr4_equal')) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
567 assert_equal(true, function('g:Test_expr4_equal') != function('g:Test_expr4_is')) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
568 |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
569 assert_equal(false, function('g:Test_expr4_equal', [123]) != function('g:Test_expr4_equal', [123])) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
570 assert_equal(true, function('g:Test_expr4_equal', [123]) != function('g:Test_expr4_is', [123])) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
571 assert_equal(true, function('g:Test_expr4_equal', [123]) != function('g:Test_expr4_equal', [999])) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
572 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
573 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
574 " test > comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 def Test_expr4_greater() |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
576 assert_true(2 > 0) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
577 assert_true(2 > |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
578 1) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
579 assert_false(2 > 2) |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
580 assert_false(2 > 3) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
581 let nr2 = 2 |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
582 assert_true(nr2 > 0) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
583 assert_true(nr2 > |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
584 1) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
585 assert_false(nr2 > 2) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
586 assert_false(nr2 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
587 > 3) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
588 if has('float') |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
589 let ff = 2.0 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
590 assert_true(ff > 0.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
591 assert_true(ff > 1.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
592 assert_false(ff > 2.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
593 assert_false(ff > 3.0) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
594 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
595 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
597 " test >= comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
598 def Test_expr4_greaterequal() |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
599 assert_true(2 >= 0) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
600 assert_true(2 >= |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
601 2) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
602 assert_false(2 >= 3) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
603 let nr2 = 2 |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
604 assert_true(nr2 >= 0) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
605 assert_true(nr2 >= 2) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
606 assert_false(nr2 >= 3) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
607 if has('float') |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
608 let ff = 2.0 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
609 assert_true(ff >= 0.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
610 assert_true(ff >= 2.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
611 assert_false(ff >= 3.0) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
612 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 " test < comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
616 def Test_expr4_smaller() |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
617 assert_false(2 < 0) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
618 assert_false(2 < |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
619 2) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
620 assert_true(2 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
621 < 3) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
622 let nr2 = 2 |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
623 assert_false(nr2 < 0) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
624 assert_false(nr2 < 2) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
625 assert_true(nr2 < 3) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
626 if has('float') |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
627 let ff = 2.0 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
628 assert_false(ff < 0.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
629 assert_false(ff < 2.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
630 assert_true(ff < 3.0) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
631 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
632 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 " test <= comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
635 def Test_expr4_smallerequal() |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
636 assert_false(2 <= 0) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
637 assert_false(2 <= |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
638 1) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
639 assert_true(2 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
640 <= 2) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
641 assert_true(2 <= 3) |
20470
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
642 let nr2 = 2 |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
643 assert_false(nr2 <= 0) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
644 assert_false(nr2 <= 1) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
645 assert_true(nr2 <= 2) |
fafa48fd3461
patch 8.2.0789: Vim9: expression testing lost coverage using constants
Bram Moolenaar <Bram@vim.org>
parents:
20413
diff
changeset
|
646 assert_true(nr2 <= 3) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
647 if has('float') |
20413
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
648 let ff = 2.0 |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
649 assert_false(ff <= 0.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
650 assert_false(ff <= 1.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
651 assert_true(ff <= 2.0) |
92826050c45e
patch 8.2.0761: Vim9: instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
20411
diff
changeset
|
652 assert_true(ff <= 3.0) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
653 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 " test =~ comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
657 def Test_expr4_match() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 assert_equal(false, '2' =~ '0') |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
659 assert_equal(false, '' |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
660 =~ '0') |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
661 assert_equal(true, '2' =~ |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
662 '[0-9]') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
663 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 " test !~ comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 def Test_expr4_nomatch() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 assert_equal(true, '2' !~ '0') |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
668 assert_equal(true, '' |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
669 !~ '0') |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
670 assert_equal(false, '2' !~ |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
671 '[0-9]') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 " test is comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 def Test_expr4_is() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
676 let mylist = [2] |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
677 assert_false(mylist is [2]) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
678 let other = mylist |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
679 assert_true(mylist is |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
680 other) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
681 |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
682 let myblob = 0z1234 |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
683 assert_false(myblob |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
684 is 0z1234) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
685 let otherblob = myblob |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
686 assert_true(myblob is otherblob) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
687 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 " test isnot comperator |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
690 def Test_expr4_isnot() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
691 let mylist = [2] |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
692 assert_true('2' isnot '0') |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
693 assert_true(mylist isnot [2]) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
694 let other = mylist |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
695 assert_false(mylist isnot |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
696 other) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
697 |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
698 let myblob = 0z1234 |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
699 assert_true(myblob |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
700 isnot 0z1234) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
701 let otherblob = myblob |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
702 assert_false(myblob isnot otherblob) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
703 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
704 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
705 def RetVoid() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
706 let x = 1 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
707 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
709 def Test_expr4_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
710 # check line continuation |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
711 let lines =<< trim END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
712 vim9script |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
713 let var = 0 |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
714 < 1 |
21425
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
715 assert_equal(true, var) |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
716 END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
717 CheckScriptSuccess(lines) |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
718 |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
719 lines =<< trim END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
720 vim9script |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
721 let var = 123 |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
722 != 123 |
21425
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
723 assert_equal(false, var) |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
724 END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
725 CheckScriptSuccess(lines) |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
726 |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
727 lines =<< trim END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
728 vim9script |
21046
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
729 let var = 123 == |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
730 123 |
21425
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
731 assert_equal(true, var) |
21046
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
732 END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
733 CheckScriptSuccess(lines) |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
734 |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
735 lines =<< trim END |
0ca7e04d39e3
patch 8.2.1074: Vim9: no line break allowed after some operators
Bram Moolenaar <Bram@vim.org>
parents:
21044
diff
changeset
|
736 vim9script |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
737 let list = [1, 2, 3] |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
738 let var = list |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
739 is list |
21425
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
740 assert_equal(true, var) |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
741 END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
742 CheckScriptSuccess(lines) |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
743 |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
744 lines =<< trim END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
745 vim9script |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
746 let myblob = 0z1234 |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
747 let var = myblob |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
748 isnot 0z11 |
21425
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
749 assert_equal(true, var) |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
750 END |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
751 CheckScriptSuccess(lines) |
21251
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
752 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
753 # spot check mismatching types |
21251
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
754 lines =<< trim END |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
755 vim9script |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
756 echo '' == 0 |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
757 END |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
758 CheckScriptFailure(lines, 'E1072:') |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
759 |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
760 lines =<< trim END |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
761 vim9script |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
762 echo v:true > v:false |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
763 END |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
764 CheckScriptFailure(lines, 'Cannot compare bool with bool') |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
765 |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
766 lines =<< trim END |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
767 vim9script |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
768 echo 123 is 123 |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
769 END |
d1215fcdbca8
patch 8.2.1176: Vim9: not enough type checking in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21248
diff
changeset
|
770 CheckScriptFailure(lines, 'Cannot use "is" with number') |
21425
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
771 |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
772 # check 'ignorecase' not being used |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
773 lines =<< trim END |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
774 vim9script |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
775 set ignorecase |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
776 assert_equal(false, 'abc' == 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
777 assert_equal(false, 'abc' ==# 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
778 assert_equal(true, 'abc' ==? 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
779 |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
780 assert_equal(true, 'abc' != 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
781 assert_equal(true, 'abc' !=# 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
782 assert_equal(false, 'abc' !=? 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
783 |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
784 assert_equal(false, 'abc' =~ 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
785 assert_equal(false, 'abc' =~# 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
786 assert_equal(true, 'abc' =~? 'ABC') |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
787 set noignorecase |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
788 END |
a6c316ef161a
patch 8.2.1263: Vim9: comperators use 'ignorecase' in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21421
diff
changeset
|
789 CheckScriptSuccess(lines) |
21636
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
790 |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
791 # check missing white space |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
792 lines =<< trim END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
793 vim9script |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
794 echo 2>3 |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
795 END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
796 CheckScriptFailure(lines, 'E1004:') |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
797 lines =<< trim END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
798 vim9script |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
799 echo 2 >3 |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
800 END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
801 CheckScriptFailure(lines, 'E1004:') |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
802 lines =<< trim END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
803 vim9script |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
804 echo 2> 3 |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
805 END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
806 CheckScriptFailure(lines, 'E1004:') |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
807 lines =<< trim END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
808 vim9script |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
809 echo 2!=3 |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
810 END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
811 CheckScriptFailure(lines, 'E1004:') |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
812 lines =<< trim END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
813 vim9script |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
814 echo 2 !=3 |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
815 END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
816 CheckScriptFailure(lines, 'E1004:') |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
817 lines =<< trim END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
818 vim9script |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
819 echo 2!= 3 |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
820 END |
dcfcb6163f3d
patch 8.2.1368: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21634
diff
changeset
|
821 CheckScriptFailure(lines, 'E1004:') |
21026
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
822 enddef |
fe2ed85db946
patch 8.2.1064: Vim9: no line break allowed before comperators
Bram Moolenaar <Bram@vim.org>
parents:
21024
diff
changeset
|
823 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
824 func Test_expr4_fails() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
825 let msg = "white space required before and after '>'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
826 call CheckDefFailure(["let x = 1>2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
827 call CheckDefFailure(["let x = 1 >2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
828 call CheckDefFailure(["let x = 1> 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
829 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
830 let msg = "white space required before and after '=='" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
831 call CheckDefFailure(["let x = 1==2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
832 call CheckDefFailure(["let x = 1 ==2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
833 call CheckDefFailure(["let x = 1== 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
834 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
835 let msg = "white space required before and after 'is'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
836 call CheckDefFailure(["let x = '1'is'2'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
837 call CheckDefFailure(["let x = '1' is'2'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
838 call CheckDefFailure(["let x = '1'is '2'"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
839 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
840 let msg = "white space required before and after 'isnot'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
841 call CheckDefFailure(["let x = '1'isnot'2'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
842 call CheckDefFailure(["let x = '1' isnot'2'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
843 call CheckDefFailure(["let x = '1'isnot '2'"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
844 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
845 call CheckDefFailure(["let x = 1 is# 2"], 'E15:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
846 call CheckDefFailure(["let x = 1 is? 2"], 'E15:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
847 call CheckDefFailure(["let x = 1 isnot# 2"], 'E15:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
848 call CheckDefFailure(["let x = 1 isnot? 2"], 'E15:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
849 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
850 call CheckDefFailure(["let x = 1 == '2'"], 'Cannot compare number with string') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
851 call CheckDefFailure(["let x = '1' == 2"], 'Cannot compare string with number') |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20318
diff
changeset
|
852 call CheckDefFailure(["let x = 1 == RetVoid()"], 'Cannot compare number with void') |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
853 call CheckDefFailure(["let x = RetVoid() == 1"], 'Cannot compare void with number') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
854 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
855 call CheckDefFailure(["let x = true > false"], 'Cannot compare bool with bool') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
856 call CheckDefFailure(["let x = true >= false"], 'Cannot compare bool with bool') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
857 call CheckDefFailure(["let x = true < false"], 'Cannot compare bool with bool') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
858 call CheckDefFailure(["let x = true <= false"], 'Cannot compare bool with bool') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
859 call CheckDefFailure(["let x = true =~ false"], 'Cannot compare bool with bool') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
860 call CheckDefFailure(["let x = true !~ false"], 'Cannot compare bool with bool') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
861 call CheckDefFailure(["let x = true is false"], 'Cannot use "is" with bool') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
862 call CheckDefFailure(["let x = true isnot false"], 'Cannot use "isnot" with bool') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
863 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
864 call CheckDefFailure(["let x = v:none is v:null"], 'Cannot use "is" with special') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
865 call CheckDefFailure(["let x = v:none isnot v:null"], 'Cannot use "isnot" with special') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
866 call CheckDefFailure(["let x = 123 is 123"], 'Cannot use "is" with number') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
867 call CheckDefFailure(["let x = 123 isnot 123"], 'Cannot use "isnot" with number') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
868 if has('float') |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
869 call CheckDefFailure(["let x = 1.3 is 1.3"], 'Cannot use "is" with float') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
870 call CheckDefFailure(["let x = 1.3 isnot 1.3"], 'Cannot use "isnot" with float') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
871 endif |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
872 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
873 call CheckDefFailure(["let x = 0za1 > 0z34"], 'Cannot compare blob with blob') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
874 call CheckDefFailure(["let x = 0za1 >= 0z34"], 'Cannot compare blob with blob') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
875 call CheckDefFailure(["let x = 0za1 < 0z34"], 'Cannot compare blob with blob') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
876 call CheckDefFailure(["let x = 0za1 <= 0z34"], 'Cannot compare blob with blob') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
877 call CheckDefFailure(["let x = 0za1 =~ 0z34"], 'Cannot compare blob with blob') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
878 call CheckDefFailure(["let x = 0za1 !~ 0z34"], 'Cannot compare blob with blob') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
879 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
880 call CheckDefFailure(["let x = [13] > [88]"], 'Cannot compare list with list') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
881 call CheckDefFailure(["let x = [13] >= [88]"], 'Cannot compare list with list') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
882 call CheckDefFailure(["let x = [13] < [88]"], 'Cannot compare list with list') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
883 call CheckDefFailure(["let x = [13] <= [88]"], 'Cannot compare list with list') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
884 call CheckDefFailure(["let x = [13] =~ [88]"], 'Cannot compare list with list') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
885 call CheckDefFailure(["let x = [13] !~ [88]"], 'Cannot compare list with list') |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
886 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
887 call CheckDefFailure(['let j: job', 'let chan: channel', 'let r = j == chan'], 'Cannot compare job with channel') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
888 call CheckDefFailure(['let j: job', 'let x: list<any>', 'let r = j == x'], 'Cannot compare job with list') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
889 call CheckDefFailure(['let j: job', 'let Xx: func', 'let r = j == Xx'], 'Cannot compare job with func') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
890 call CheckDefFailure(['let j: job', 'let Xx: func', 'let r = j == Xx'], 'Cannot compare job with func') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
891 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
892 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
893 " test addition, subtraction, concatenation |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
894 def Test_expr5() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
895 assert_equal(66, 60 + 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
896 assert_equal(70, 60 + |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
897 g:anint) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
898 assert_equal(9, g:alsoint |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
899 + 5) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
900 assert_equal(14, g:alsoint + g:anint) |
20919
96bf2b304932
patch 8.2.1011: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
20470
diff
changeset
|
901 assert_equal([1, 2, 3, 4], [1] + g:alist) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
902 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
903 assert_equal(54, 60 - 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
904 assert_equal(50, 60 - |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
905 g:anint) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
906 assert_equal(-1, g:alsoint |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
907 - 5) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
908 assert_equal(-6, g:alsoint - g:anint) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
909 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
910 assert_equal('hello', 'hel' .. 'lo') |
20318
3cbcee39fc5c
patch 8.2.0714: Vim9: handling constant expression does not scale
Bram Moolenaar <Bram@vim.org>
parents:
20305
diff
changeset
|
911 assert_equal('hello 123', 'hello ' .. |
3cbcee39fc5c
patch 8.2.0714: Vim9: handling constant expression does not scale
Bram Moolenaar <Bram@vim.org>
parents:
20305
diff
changeset
|
912 123) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
913 assert_equal('hello 123', 'hello ' |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
914 .. 123) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
915 assert_equal('123 hello', 123 .. ' hello') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
916 assert_equal('123456', 123 .. 456) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
917 |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
918 assert_equal([1, 2, 3, 4], [1, 2] + [3, 4]) |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
919 assert_equal(0z11223344, 0z1122 + 0z3344) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
920 assert_equal(0z112201ab, 0z1122 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
921 + g:ablob) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
922 assert_equal(0z01ab3344, g:ablob + 0z3344) |
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
923 assert_equal(0z01ab01ab, g:ablob + g:ablob) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
924 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
925 |
20992
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
926 def Test_expr5_vim9script() |
21546
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
927 # check line continuation |
20992
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
928 let lines =<< trim END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
929 vim9script |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
930 let var = 11 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
931 + 77 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
932 - 22 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
933 assert_equal(66, var) |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
934 END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
935 CheckScriptSuccess(lines) |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
936 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
937 lines =<< trim END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
938 vim9script |
21634
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
939 let var = 11 + |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
940 77 - |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
941 22 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
942 assert_equal(66, var) |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
943 END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
944 CheckScriptSuccess(lines) |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
945 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
946 lines =<< trim END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
947 vim9script |
20992
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
948 let var = 'one' |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
949 .. 'two' |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
950 assert_equal('onetwo', var) |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
951 END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
952 CheckScriptSuccess(lines) |
21546
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
953 |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
954 lines =<< trim END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
955 vim9script |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
956 echo 'abc' is# 'abc' |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
957 END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
958 CheckScriptFailure(lines, 'E15:') |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
959 |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
960 lines =<< trim END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
961 vim9script |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
962 echo 'abc' is? 'abc' |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
963 END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
964 CheckScriptFailure(lines, 'E15:') |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
965 |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
966 lines =<< trim END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
967 vim9script |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
968 echo 'abc' isnot# 'abc' |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
969 END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
970 CheckScriptFailure(lines, 'E15:') |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
971 |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
972 lines =<< trim END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
973 vim9script |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
974 echo 'abc' isnot? 'abc' |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
975 END |
4d3e983313dc
patch 8.2.1323: Vim9: invalid operators only rejected in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21544
diff
changeset
|
976 CheckScriptFailure(lines, 'E15:') |
21630
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
977 |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
978 # check white space |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
979 lines =<< trim END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
980 vim9script |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
981 echo 5+6 |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
982 END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
983 CheckScriptFailure(lines, 'E1004:') |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
984 lines =<< trim END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
985 vim9script |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
986 echo 5 +6 |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
987 END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
988 CheckScriptFailure(lines, 'E1004:') |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
989 lines =<< trim END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
990 vim9script |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
991 echo 5+ 6 |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
992 END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
993 CheckScriptFailure(lines, 'E1004:') |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
994 |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
995 lines =<< trim END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
996 vim9script |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
997 echo 'a'..'b' |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
998 END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
999 CheckScriptFailure(lines, 'E1004:') |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1000 lines =<< trim END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1001 vim9script |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1002 echo 'a' ..'b' |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1003 END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1004 CheckScriptFailure(lines, 'E1004:') |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1005 lines =<< trim END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1006 vim9script |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1007 echo 'a'.. 'b' |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1008 END |
3c6c52fbc8ea
patch 8.2.1365: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21614
diff
changeset
|
1009 CheckScriptFailure(lines, 'E1004:') |
20992
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1010 enddef |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1011 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1012 def Test_expr5_float() |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1013 if !has('float') |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1014 MissingFeature 'float' |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1015 else |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1016 assert_equal(66.0, 60.0 + 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1017 assert_equal(66.0, 60.0 + 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1018 assert_equal(66.0, 60 + |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1019 6.0) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1020 assert_equal(5.1, g:afloat |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1021 + 5) |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1022 assert_equal(8.1, 8 + g:afloat) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1023 assert_equal(10.1, g:anint + g:afloat) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1024 assert_equal(10.1, g:afloat + g:anint) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1025 |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1026 assert_equal(54.0, 60.0 - 6.0) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1027 assert_equal(54.0, 60.0 |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1028 - 6) |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1029 assert_equal(54.0, 60 - 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1030 assert_equal(-4.9, g:afloat - 5) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1031 assert_equal(7.9, 8 - g:afloat) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1032 assert_equal(9.9, g:anint - g:afloat) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1033 assert_equal(-9.9, g:afloat - g:anint) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1034 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1035 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1036 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1037 func Test_expr5_fails() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1038 let msg = "white space required before and after '+'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1039 call CheckDefFailure(["let x = 1+2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1040 call CheckDefFailure(["let x = 1 +2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1041 call CheckDefFailure(["let x = 1+ 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1042 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1043 let msg = "white space required before and after '-'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1044 call CheckDefFailure(["let x = 1-2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1045 call CheckDefFailure(["let x = 1 -2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1046 call CheckDefFailure(["let x = 1- 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1047 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1048 let msg = "white space required before and after '..'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1049 call CheckDefFailure(["let x = '1'..'2'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1050 call CheckDefFailure(["let x = '1' ..'2'"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1051 call CheckDefFailure(["let x = '1'.. '2'"], msg) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
1052 |
20982
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20955
diff
changeset
|
1053 call CheckDefFailure(["let x = 0z1122 + 33"], 'E1051') |
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20955
diff
changeset
|
1054 call CheckDefFailure(["let x = 0z1122 + [3]"], 'E1051') |
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20955
diff
changeset
|
1055 call CheckDefFailure(["let x = 0z1122 + 'asd'"], 'E1051') |
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20955
diff
changeset
|
1056 call CheckDefFailure(["let x = 33 + 0z1122"], 'E1051') |
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20955
diff
changeset
|
1057 call CheckDefFailure(["let x = [3] + 0z1122"], 'E1051') |
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20955
diff
changeset
|
1058 call CheckDefFailure(["let x = 'asdf' + 0z1122"], 'E1051') |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1059 call CheckDefFailure(["let x = 6 + xxx"], 'E1001') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1060 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1061 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1062 " test multiply, divide, modulo |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1063 def Test_expr6() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1064 assert_equal(36, 6 * 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1065 assert_equal(24, 6 * |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1066 g:alsoint) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1067 assert_equal(24, g:alsoint |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1068 * 6) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1069 assert_equal(40, g:anint * g:alsoint) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1070 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1071 assert_equal(10, 60 / 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1072 assert_equal(6, 60 / |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1073 g:anint) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1074 assert_equal(1, g:anint / 6) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1075 assert_equal(2, g:anint |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1076 / g:alsoint) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1077 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1078 assert_equal(5, 11 % 6) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1079 assert_equal(4, g:anint % 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1080 assert_equal(3, 13 % |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1081 g:anint) |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1082 assert_equal(2, g:anint |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1083 % g:alsoint) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1084 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1085 assert_equal(4, 6 * 4 / 6) |
19423
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1086 |
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1087 let x = [2] |
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1088 let y = [3] |
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1089 assert_equal(5, x[0] + y[0]) |
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1090 assert_equal(6, x[0] * y[0]) |
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1091 if has('float') |
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1092 let xf = [2.0] |
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1093 let yf = [3.0] |
20988
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1094 assert_equal(5.0, xf[0] |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1095 + yf[0]) |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1096 assert_equal(6.0, xf[0] |
ae4b1d497a06
patch 8.2.1045: Vim9: line break before operator does not work
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1097 * yf[0]) |
19423
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1098 endif |
19856
90eec641cc8c
patch 8.2.0484: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19854
diff
changeset
|
1099 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1100 call CheckDefFailure(["let x = 6 * xxx"], 'E1001') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1101 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1102 |
20992
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1103 def Test_expr6_vim9script() |
21634
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1104 # check line continuation |
20992
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1105 let lines =<< trim END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1106 vim9script |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1107 let var = 11 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1108 * 22 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1109 / 3 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1110 assert_equal(80, var) |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1111 END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1112 CheckScriptSuccess(lines) |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1113 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1114 lines =<< trim END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1115 vim9script |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1116 let var = 25 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1117 % 10 |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1118 assert_equal(5, var) |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1119 END |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1120 CheckScriptSuccess(lines) |
21634
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1121 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1122 lines =<< trim END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1123 vim9script |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1124 let var = 11 * |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1125 22 / |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1126 3 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1127 assert_equal(80, var) |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1128 END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1129 CheckScriptSuccess(lines) |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1130 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1131 # check white space |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1132 lines =<< trim END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1133 vim9script |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1134 echo 5*6 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1135 END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1136 CheckScriptFailure(lines, 'E1004:') |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1137 lines =<< trim END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1138 vim9script |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1139 echo 5 *6 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1140 END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1141 CheckScriptFailure(lines, 'E1004:') |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1142 lines =<< trim END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1143 vim9script |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1144 echo 5* 6 |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1145 END |
3a86e41fdffd
patch 8.2.1367: Vim9: no error for missing white space around operator
Bram Moolenaar <Bram@vim.org>
parents:
21630
diff
changeset
|
1146 CheckScriptFailure(lines, 'E1004:') |
20992
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1147 enddef |
7ee565134d4a
patch 8.2.1047: Vim9: script cannot use line continuation like :def function
Bram Moolenaar <Bram@vim.org>
parents:
20988
diff
changeset
|
1148 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1149 def Test_expr6_float() |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1150 if !has('float') |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1151 MissingFeature 'float' |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1152 else |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1153 assert_equal(36.0, 6.0 * 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1154 assert_equal(36.0, 6 * |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1155 6.0) |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1156 assert_equal(36.0, 6.0 * 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1157 assert_equal(1.0, g:afloat * g:anint) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1158 |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1159 assert_equal(10.0, 60 / 6.0) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1160 assert_equal(10.0, 60.0 / |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1161 6) |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1162 assert_equal(10.0, 60.0 / 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1163 assert_equal(0.01, g:afloat / g:anint) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1164 |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1165 assert_equal(4.0, 6.0 * 4 / 6) |
20013
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1166 assert_equal(4.0, 6 * |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1167 4.0 / |
bf377a9ffccb
patch 8.2.0562: Vim9: cannot split an expression into multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
20005
diff
changeset
|
1168 6) |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1169 assert_equal(4.0, 6 * 4 / 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1170 assert_equal(4.0, 6.0 * 4.0 / 6) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1171 assert_equal(4.0, 6 * 4.0 / 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1172 assert_equal(4.0, 6.0 * 4 / 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1173 assert_equal(4.0, 6.0 * 4.0 / 6.0) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1174 |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1175 assert_equal(4.0, 6.0 * 4.0 / 6.0) |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1176 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1177 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1178 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1179 func Test_expr6_fails() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1180 let msg = "white space required before and after '*'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1181 call CheckDefFailure(["let x = 1*2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1182 call CheckDefFailure(["let x = 1 *2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1183 call CheckDefFailure(["let x = 1* 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1184 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1185 let msg = "white space required before and after '/'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1186 call CheckDefFailure(["let x = 1/2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1187 call CheckDefFailure(["let x = 1 /2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1188 call CheckDefFailure(["let x = 1/ 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1189 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1190 let msg = "white space required before and after '%'" |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1191 call CheckDefFailure(["let x = 1%2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1192 call CheckDefFailure(["let x = 1 %2"], msg) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1193 call CheckDefFailure(["let x = 1% 2"], msg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1194 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1195 call CheckDefFailure(["let x = '1' * '2'"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1196 call CheckDefFailure(["let x = '1' / '2'"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1197 call CheckDefFailure(["let x = '1' % '2'"], 'E1035:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1198 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1199 call CheckDefFailure(["let x = 0z01 * 0z12"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1200 call CheckDefFailure(["let x = 0z01 / 0z12"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1201 call CheckDefFailure(["let x = 0z01 % 0z12"], 'E1035:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1202 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1203 call CheckDefFailure(["let x = [1] * [2]"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1204 call CheckDefFailure(["let x = [1] / [2]"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1205 call CheckDefFailure(["let x = [1] % [2]"], 'E1035:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1206 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1207 call CheckDefFailure(["let x = #{one: 1} * #{two: 2}"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1208 call CheckDefFailure(["let x = #{one: 1} / #{two: 2}"], 'E1036:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1209 call CheckDefFailure(["let x = #{one: 1} % #{two: 2}"], 'E1035:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1210 |
20349
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20328
diff
changeset
|
1211 call CheckDefFailure(["let x = 0xff[1]"], 'E1090:') |
19423
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1212 if has('float') |
20349
e29b2ec8d4d2
patch 8.2.0730: Vim9: Assignment to dict member does not work
Bram Moolenaar <Bram@vim.org>
parents:
20328
diff
changeset
|
1213 call CheckDefFailure(["let x = 0.7[1]"], 'E1090:') |
19423
f3e8e74cb747
patch 8.2.0269: Vim9: operator after list index does not work
Bram Moolenaar <Bram@vim.org>
parents:
19259
diff
changeset
|
1214 endif |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1215 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1216 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1217 func Test_expr6_float_fails() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1218 CheckFeature float |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1219 call CheckDefFailure(["let x = 1.0 % 2"], 'E1035:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1220 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1221 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1222 " define here to use old style parsing |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1223 if has('float') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1224 let g:float_zero = 0.0 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1225 let g:float_neg = -9.8 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1226 let g:float_big = 9.9e99 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1227 endif |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1228 let g:blob_empty = 0z |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1229 let g:blob_one = 0z01 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1230 let g:blob_long = 0z0102.0304 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1231 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1232 let g:string_empty = '' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1233 let g:string_short = 'x' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1234 let g:string_long = 'abcdefghijklm' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1235 let g:string_special = "ab\ncd\ref\ekk" |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1236 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1237 let g:special_true = v:true |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1238 let g:special_false = v:false |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1239 let g:special_null = v:null |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1240 let g:special_none = v:none |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1241 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1242 let g:list_empty = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1243 let g:list_mixed = [1, 'b', v:false] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1244 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1245 let g:dict_empty = {} |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1246 let g:dict_one = #{one: 1} |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1247 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1248 let $TESTVAR = 'testvar' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1249 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1250 " test low level expression |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1251 def Test_expr7_number() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1252 # number constant |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1253 assert_equal(0, 0) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1254 assert_equal(654, 0654) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1255 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1256 assert_equal(6, 0x6) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1257 assert_equal(15, 0xf) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1258 assert_equal(255, 0xff) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1259 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1260 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1261 def Test_expr7_float() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1262 # float constant |
19259
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1263 if !has('float') |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1264 MissingFeature 'float' |
77cce0439714
patch 8.2.0188: Check commands don't work well with Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1265 else |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1266 assert_equal(g:float_zero, .0) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1267 assert_equal(g:float_zero, 0.0) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1268 assert_equal(g:float_neg, -9.8) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1269 assert_equal(g:float_big, 9.9e99) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1270 endif |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1271 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1272 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1273 def Test_expr7_blob() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1274 # blob constant |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1275 assert_equal(g:blob_empty, 0z) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1276 assert_equal(g:blob_one, 0z01) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1277 assert_equal(g:blob_long, 0z0102.0304) |
19856
90eec641cc8c
patch 8.2.0484: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19854
diff
changeset
|
1278 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1279 call CheckDefFailure(["let x = 0z123"], 'E973:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1280 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1281 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1282 def Test_expr7_string() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1283 # string constant |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1284 assert_equal(g:string_empty, '') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1285 assert_equal(g:string_empty, "") |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1286 assert_equal(g:string_short, 'x') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1287 assert_equal(g:string_short, "x") |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1288 assert_equal(g:string_long, 'abcdefghijklm') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1289 assert_equal(g:string_long, "abcdefghijklm") |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1290 assert_equal(g:string_special, "ab\ncd\ref\ekk") |
19856
90eec641cc8c
patch 8.2.0484: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19854
diff
changeset
|
1291 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1292 call CheckDefFailure(['let x = "abc'], 'E114:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1293 call CheckDefFailure(["let x = 'abc"], 'E115:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1294 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1295 |
19960
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1296 def Test_expr7_vimvar() |
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1297 let old: list<string> = v:oldfiles |
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1298 let compl: dict<any> = v:completed_item |
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1299 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1300 call CheckDefFailure(["let old: list<number> = v:oldfiles"], 'E1013: type mismatch, expected list<number> but got list<string>') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1301 call CheckDefFailure(["let old: dict<number> = v:completed_item"], 'E1013: type mismatch, expected dict<number> but got dict<any>') |
19960
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1302 enddef |
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1303 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1304 def Test_expr7_special() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1305 # special constant |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1306 assert_equal(g:special_true, true) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1307 assert_equal(g:special_false, false) |
19960
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1308 assert_equal(g:special_true, v:true) |
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1309 assert_equal(g:special_false, v:false) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1310 assert_equal(g:special_null, v:null) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1311 assert_equal(g:special_none, v:none) |
19960
3c11b9f6fa03
patch 8.2.0536: Vim9: some compilation code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1312 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1313 call CheckDefFailure(['v:true = true'], 'E46:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1314 call CheckDefFailure(['v:true = false'], 'E46:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1315 call CheckDefFailure(['v:false = true'], 'E46:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1316 call CheckDefFailure(['v:null = 11'], 'E46:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1317 call CheckDefFailure(['v:none = 22'], 'E46:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1318 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1319 |
21307
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1320 def Test_expr7_special_vim9script() |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1321 let lines =<< trim END |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1322 vim9script |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1323 let t = true |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1324 let f = false |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1325 assert_equal(v:true, true) |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1326 assert_equal(true, t) |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1327 assert_equal(v:false, false) |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1328 assert_equal(false, f) |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1329 END |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1330 CheckScriptSuccess(lines) |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1331 enddef |
b991565745fb
patch 8.2.1204: Vim9: true and false not recognized in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
21277
diff
changeset
|
1332 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1333 def Test_expr7_list() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1334 # list |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1335 assert_equal(g:list_empty, []) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1336 assert_equal(g:list_empty, [ ]) |
21028
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1337 assert_equal(g:list_mixed, [1, 'b', false,]) |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1338 assert_equal('b', g:list_mixed[1]) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
1339 |
21562
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1340 echo [1, |
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1341 2] [3, |
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1342 4] |
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1343 |
20287
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1344 call CheckDefExecFailure(["let x = g:anint[3]"], 'E714:') |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1345 call CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:') |
21216
bcd08812cde3
patch 8.2.1159: Vim9: no error for missing space after a comma
Bram Moolenaar <Bram@vim.org>
parents:
21210
diff
changeset
|
1346 call CheckDefFailure(["let x = [1,2,3]"], 'E1069:') |
21387
8d58cbb07a12
patch 8.2.1244: Vim9: in lambda index assumes a list
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
1347 call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E1029:') |
21248
4edc60c9c0aa
patch 8.2.1175: Vim9: cannot split a line before ".member"
Bram Moolenaar <Bram@vim.org>
parents:
21232
diff
changeset
|
1348 call CheckDefFailure(["let x = g:list_mixed["], 'E1097:') |
4edc60c9c0aa
patch 8.2.1175: Vim9: cannot split a line before ".member"
Bram Moolenaar <Bram@vim.org>
parents:
21232
diff
changeset
|
1349 call CheckDefFailure(["let x = g:list_mixed[0"], 'E1097:') |
20287
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1350 call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1351 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1352 |
21028
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1353 def Test_expr7_list_vim9script() |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1354 let lines =<< trim END |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1355 vim9script |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1356 let l = [ |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1357 11, |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1358 22, |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1359 ] |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1360 assert_equal([11, 22], l) |
21562
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1361 |
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1362 echo [1, |
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1363 2] [3, |
55aa283a0e5e
patch 8.2.1331: Vim9: :echo with two lists doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21546
diff
changeset
|
1364 4] |
21028
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1365 END |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1366 CheckScriptSuccess(lines) |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1367 |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1368 lines =<< trim END |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1369 vim9script |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1370 let l = [11, |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1371 22] |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1372 assert_equal([11, 22], l) |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1373 END |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1374 CheckScriptSuccess(lines) |
21034
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1375 |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1376 lines =<< trim END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1377 vim9script |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1378 let l = [11,22] |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1379 END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1380 CheckScriptFailure(lines, 'E1069:') |
21028
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1381 enddef |
7acceb76669f
patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents:
21026
diff
changeset
|
1382 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1383 def Test_expr7_lambda() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1384 let La = { -> 'result'} |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1385 assert_equal('result', La()) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1386 assert_equal([1, 3, 5], [1, 2, 3]->map({key, val -> key + val})) |
21263
71bd2f9adb61
patch 8.2.1182: Vim9: no check for whitespace after comma in lambda
Bram Moolenaar <Bram@vim.org>
parents:
21251
diff
changeset
|
1387 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1388 # line continuation inside lambda with "cond ? expr : expr" works |
21277
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1389 let ll = range(3) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1390 map(ll, {k, v -> v % 2 ? { |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1391 '111': 111 } : {} |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1392 }) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1393 assert_equal([{}, {'111': 111}, {}], ll) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1394 |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1395 ll = range(3) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1396 map(ll, {k, v -> v == 8 || v |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1397 == 9 |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1398 || v % 2 ? 111 : 222 |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1399 }) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1400 assert_equal([222, 111, 222], ll) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1401 |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1402 ll = range(3) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1403 map(ll, {k, v -> v != 8 && v |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1404 != 9 |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1405 && v % 2 == 0 ? 111 : 222 |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1406 }) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1407 assert_equal([111, 222, 111], ll) |
1e5c29d4e5b3
patch 8.2.1189: Vim9: line continuation in lambda doesn't always work
Bram Moolenaar <Bram@vim.org>
parents:
21263
diff
changeset
|
1408 |
21387
8d58cbb07a12
patch 8.2.1244: Vim9: in lambda index assumes a list
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
1409 let dl = [{'key': 0}, {'key': 22}]->filter({ _, v -> v['key'] }) |
8d58cbb07a12
patch 8.2.1244: Vim9: in lambda index assumes a list
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
1410 assert_equal([{'key': 22}], dl) |
8d58cbb07a12
patch 8.2.1244: Vim9: in lambda index assumes a list
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
1411 |
21411
e1aeb986712f
patch 8.2.1256: Vim9: type wrong after getting dict item in lambda
Bram Moolenaar <Bram@vim.org>
parents:
21399
diff
changeset
|
1412 dl = [{'key': 12}, {'foo': 34}] |
e1aeb986712f
patch 8.2.1256: Vim9: type wrong after getting dict item in lambda
Bram Moolenaar <Bram@vim.org>
parents:
21399
diff
changeset
|
1413 assert_equal([{'key': 12}], filter(dl, |
e1aeb986712f
patch 8.2.1256: Vim9: type wrong after getting dict item in lambda
Bram Moolenaar <Bram@vim.org>
parents:
21399
diff
changeset
|
1414 {_, v -> has_key(v, 'key') ? v['key'] == 12 : 0})) |
e1aeb986712f
patch 8.2.1256: Vim9: type wrong after getting dict item in lambda
Bram Moolenaar <Bram@vim.org>
parents:
21399
diff
changeset
|
1415 |
21263
71bd2f9adb61
patch 8.2.1182: Vim9: no check for whitespace after comma in lambda
Bram Moolenaar <Bram@vim.org>
parents:
21251
diff
changeset
|
1416 call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1417 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1418 |
21040
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1419 def Test_expr7_lambda_vim9script() |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1420 let lines =<< trim END |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1421 vim9script |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1422 let v = 10->{a -> |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1423 a |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1424 + 2 |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1425 }() |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1426 assert_equal(12, v) |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1427 END |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1428 CheckScriptSuccess(lines) |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1429 enddef |
d9e0db9b2b99
patch 8.2.1071: Vim9: no line break allowed inside a lambda
Bram Moolenaar <Bram@vim.org>
parents:
21034
diff
changeset
|
1430 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1431 def Test_expr7_dict() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1432 # dictionary |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1433 assert_equal(g:dict_empty, {}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1434 assert_equal(g:dict_empty, { }) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1435 assert_equal(g:dict_one, {'one': 1}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1436 let key = 'one' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1437 let val = 1 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1438 assert_equal(g:dict_one, {key: val}) |
19461
08ef11a81daa
patch 8.2.0288: Vim9: some float and blob operators not tested
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
1439 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1440 call CheckDefFailure(["let x = #{8: 8}"], 'E1014:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1441 call CheckDefFailure(["let x = #{xxx}"], 'E720:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1442 call CheckDefFailure(["let x = #{xxx: 1", "let y = 2"], 'E722:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1443 call CheckDefFailure(["let x = #{xxx: 1,"], 'E723:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1444 call CheckDefFailure(["let x = {'a': xxx}"], 'E1001:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1445 call CheckDefFailure(["let x = {xxx: 8}"], 'E1001:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1446 call CheckDefFailure(["let x = #{a: 1, a: 2}"], 'E721:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1447 call CheckDefFailure(["let x = #"], 'E1015:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1448 call CheckDefFailure(["let x += 1"], 'E1020:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1449 call CheckDefFailure(["let x = x + 1"], 'E1001:') |
20287
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1450 call CheckDefExecFailure(["let x = g:anint.member"], 'E715:') |
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1451 call CheckDefExecFailure(["let x = g:dict_empty.member"], 'E716:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1452 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1453 |
21034
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1454 def Test_expr7_dict_vim9script() |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1455 let lines =<< trim END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1456 vim9script |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1457 let d = { |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1458 'one': |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1459 1, |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1460 'two': 2, |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1461 } |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1462 assert_equal({'one': 1, 'two': 2}, d) |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1463 END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1464 CheckScriptSuccess(lines) |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1465 |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1466 lines =<< trim END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1467 vim9script |
21118
b0baa80cb53f
patch 8.2.1110: Vim9: line continuation does not work in function arguments
Bram Moolenaar <Bram@vim.org>
parents:
21046
diff
changeset
|
1468 let d = { "one": "one", "two": "two", } |
b0baa80cb53f
patch 8.2.1110: Vim9: line continuation does not work in function arguments
Bram Moolenaar <Bram@vim.org>
parents:
21046
diff
changeset
|
1469 assert_equal({'one': 'one', 'two': 'two'}, d) |
b0baa80cb53f
patch 8.2.1110: Vim9: line continuation does not work in function arguments
Bram Moolenaar <Bram@vim.org>
parents:
21046
diff
changeset
|
1470 END |
b0baa80cb53f
patch 8.2.1110: Vim9: line continuation does not work in function arguments
Bram Moolenaar <Bram@vim.org>
parents:
21046
diff
changeset
|
1471 CheckScriptSuccess(lines) |
b0baa80cb53f
patch 8.2.1110: Vim9: line continuation does not work in function arguments
Bram Moolenaar <Bram@vim.org>
parents:
21046
diff
changeset
|
1472 |
b0baa80cb53f
patch 8.2.1110: Vim9: line continuation does not work in function arguments
Bram Moolenaar <Bram@vim.org>
parents:
21046
diff
changeset
|
1473 lines =<< trim END |
b0baa80cb53f
patch 8.2.1110: Vim9: line continuation does not work in function arguments
Bram Moolenaar <Bram@vim.org>
parents:
21046
diff
changeset
|
1474 vim9script |
21034
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1475 let d = #{one: 1, |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1476 two: 2, |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1477 } |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1478 assert_equal({'one': 1, 'two': 2}, d) |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1479 END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1480 CheckScriptSuccess(lines) |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1481 |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1482 lines =<< trim END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1483 vim9script |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1484 let d = #{one:1, two: 2} |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1485 END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1486 CheckScriptFailure(lines, 'E1069:') |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1487 |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1488 lines =<< trim END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1489 vim9script |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1490 let d = #{one: 1,two: 2} |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1491 END |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1492 CheckScriptFailure(lines, 'E1069:') |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1493 enddef |
2f8b0812819f
patch 8.2.1068: Vim9: no line break allowed inside a dict
Bram Moolenaar <Bram@vim.org>
parents:
21032
diff
changeset
|
1494 |
21168
f26a606e6dbc
patch 8.2.1135: Vim9: getting a dict member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21166
diff
changeset
|
1495 let g:oneString = 'one' |
f26a606e6dbc
patch 8.2.1135: Vim9: getting a dict member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21166
diff
changeset
|
1496 |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1497 def Test_expr_member() |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1498 assert_equal(1, g:dict_one.one) |
20411
23af9e1a5283
patch 8.2.0760: Vim9: dict member errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
1499 let d: dict<number> = g:dict_one |
23af9e1a5283
patch 8.2.0760: Vim9: dict member errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
1500 assert_equal(1, d['one']) |
21248
4edc60c9c0aa
patch 8.2.1175: Vim9: cannot split a line before ".member"
Bram Moolenaar <Bram@vim.org>
parents:
21232
diff
changeset
|
1501 assert_equal(1, d[ |
4edc60c9c0aa
patch 8.2.1175: Vim9: cannot split a line before ".member"
Bram Moolenaar <Bram@vim.org>
parents:
21232
diff
changeset
|
1502 'one' |
4edc60c9c0aa
patch 8.2.1175: Vim9: cannot split a line before ".member"
Bram Moolenaar <Bram@vim.org>
parents:
21232
diff
changeset
|
1503 ]) |
4edc60c9c0aa
patch 8.2.1175: Vim9: cannot split a line before ".member"
Bram Moolenaar <Bram@vim.org>
parents:
21232
diff
changeset
|
1504 assert_equal(1, d |
4edc60c9c0aa
patch 8.2.1175: Vim9: cannot split a line before ".member"
Bram Moolenaar <Bram@vim.org>
parents:
21232
diff
changeset
|
1505 .one) |
21512
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1506 d = {'1': 1, '_': 2} |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1507 assert_equal(1, d |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1508 .1) |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1509 assert_equal(2, d |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1510 ._) |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1511 |
21152
1561311249bb
patch 8.2.1127: Vim9: getting a dict member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21142
diff
changeset
|
1512 # getting the one member should clear the dict after getting the item |
1561311249bb
patch 8.2.1127: Vim9: getting a dict member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21142
diff
changeset
|
1513 assert_equal('one', #{one: 'one'}.one) |
21168
f26a606e6dbc
patch 8.2.1135: Vim9: getting a dict member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21166
diff
changeset
|
1514 assert_equal('one', #{one: 'one'}[g:oneString]) |
21152
1561311249bb
patch 8.2.1127: Vim9: getting a dict member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21142
diff
changeset
|
1515 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1516 call CheckDefFailure(["let x = g:dict_one.#$!"], 'E1002:') |
20411
23af9e1a5283
patch 8.2.0760: Vim9: dict member errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
1517 call CheckDefExecFailure(["let d: dict<any>", "echo d['a']"], 'E716:') |
23af9e1a5283
patch 8.2.0760: Vim9: dict member errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
1518 call CheckDefExecFailure(["let d: dict<number>", "d = g:list_empty"], 'E1029: Expected dict but got list') |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1519 enddef |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1520 |
21166
64f664f9b23a
patch 8.2.1134: Vim9: getting a list member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21152
diff
changeset
|
1521 def Test_expr_index() |
64f664f9b23a
patch 8.2.1134: Vim9: getting a list member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21152
diff
changeset
|
1522 # getting the one member should clear the list only after getting the item |
64f664f9b23a
patch 8.2.1134: Vim9: getting a list member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21152
diff
changeset
|
1523 assert_equal('bbb', ['aaa', 'bbb', 'ccc'][1]) |
64f664f9b23a
patch 8.2.1134: Vim9: getting a list member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21152
diff
changeset
|
1524 enddef |
64f664f9b23a
patch 8.2.1134: Vim9: getting a list member may not work
Bram Moolenaar <Bram@vim.org>
parents:
21152
diff
changeset
|
1525 |
21142
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1526 def Test_expr_member_vim9script() |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1527 let lines =<< trim END |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1528 vim9script |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1529 let d = #{one: |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1530 'one', |
21512
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1531 two: 'two', |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1532 1: 1, |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1533 _: 2} |
21142
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1534 assert_equal('one', d.one) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1535 assert_equal('one', d |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1536 .one) |
21512
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1537 assert_equal(1, d |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1538 .1) |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1539 assert_equal(2, d |
81c47a694479
patch 8.2.1306: checking for first character of dict key is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
21465
diff
changeset
|
1540 ._) |
21142
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1541 assert_equal('one', d[ |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1542 'one' |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1543 ]) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1544 END |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1545 CheckScriptSuccess(lines) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1546 |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1547 lines =<< trim END |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1548 vim9script |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1549 let l = [1, |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1550 2, |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1551 3, 4 |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1552 ] |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1553 assert_equal(2, l[ |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1554 1 |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1555 ]) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1556 assert_equal([2, 3], l[1 : 2]) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1557 assert_equal([1, 2, 3], l[ |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1558 : |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1559 2 |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1560 ]) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1561 assert_equal([3, 4], l[ |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1562 2 |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1563 : |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1564 ]) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1565 END |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1566 CheckScriptSuccess(lines) |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1567 enddef |
165cea61e974
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Bram Moolenaar <Bram@vim.org>
parents:
21122
diff
changeset
|
1568 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1569 def Test_expr7_option() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1570 # option |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1571 set ts=11 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1572 assert_equal(11, &ts) |
19449
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19437
diff
changeset
|
1573 &ts = 9 |
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19437
diff
changeset
|
1574 assert_equal(9, &ts) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1575 set ts=8 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1576 set grepprg=some\ text |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1577 assert_equal('some text', &grepprg) |
19219
89931701e033
patch 8.2.0168: Coverity warning for assigning NULL to an option
Bram Moolenaar <Bram@vim.org>
parents:
19217
diff
changeset
|
1578 &grepprg = test_null_string() |
89931701e033
patch 8.2.0168: Coverity warning for assigning NULL to an option
Bram Moolenaar <Bram@vim.org>
parents:
19217
diff
changeset
|
1579 assert_equal('', &grepprg) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1580 set grepprg& |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1581 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1582 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1583 def Test_expr7_environment() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1584 # environment variable |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1585 assert_equal('testvar', $TESTVAR) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1586 assert_equal('', $ASDF_ASD_XXX) |
19842
e4ade28bfaf7
patch 8.2.0477: Vim9: error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19826
diff
changeset
|
1587 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1588 call CheckDefFailure(["let x = $$$"], 'E1002:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1589 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1590 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1591 def Test_expr7_register() |
19449
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19437
diff
changeset
|
1592 @a = 'register a' |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1593 assert_equal('register a', @a) |
21612
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1594 |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1595 let fname = expand('%') |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1596 assert_equal(fname, @%) |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1597 |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1598 feedkeys(":echo 'some'\<CR>", "xt") |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1599 assert_equal("echo 'some'", @:) |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1600 |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1601 normal axyz |
c495d3e30f4b
patch 8.2.1356: Vim9: cannot get the percent register
Bram Moolenaar <Bram@vim.org>
parents:
21562
diff
changeset
|
1602 assert_equal("xyz", @.) |
21614
d0128ecd4341
patch 8.2.1357: Vim9: cannot assign to / register
Bram Moolenaar <Bram@vim.org>
parents:
21612
diff
changeset
|
1603 call CheckDefFailure(["@. = 'yes'"], 'E354:') |
d0128ecd4341
patch 8.2.1357: Vim9: cannot assign to / register
Bram Moolenaar <Bram@vim.org>
parents:
21612
diff
changeset
|
1604 |
d0128ecd4341
patch 8.2.1357: Vim9: cannot assign to / register
Bram Moolenaar <Bram@vim.org>
parents:
21612
diff
changeset
|
1605 @/ = 'slash' |
d0128ecd4341
patch 8.2.1357: Vim9: cannot assign to / register
Bram Moolenaar <Bram@vim.org>
parents:
21612
diff
changeset
|
1606 assert_equal('slash', @/) |
d0128ecd4341
patch 8.2.1357: Vim9: cannot assign to / register
Bram Moolenaar <Bram@vim.org>
parents:
21612
diff
changeset
|
1607 |
d0128ecd4341
patch 8.2.1357: Vim9: cannot assign to / register
Bram Moolenaar <Bram@vim.org>
parents:
21612
diff
changeset
|
1608 @= = 'equal' |
d0128ecd4341
patch 8.2.1357: Vim9: cannot assign to / register
Bram Moolenaar <Bram@vim.org>
parents:
21612
diff
changeset
|
1609 assert_equal('equal', @=) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1610 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1611 |
21399
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1612 def Test_expr7_namespace() |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1613 g:some_var = 'some' |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1614 assert_equal('some', get(g:, 'some_var')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1615 assert_equal('some', get(g:, 'some_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1616 assert_equal('xxx', get(g:, 'no_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1617 unlet g:some_var |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1618 |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1619 b:some_var = 'some' |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1620 assert_equal('some', get(b:, 'some_var')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1621 assert_equal('some', get(b:, 'some_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1622 assert_equal('xxx', get(b:, 'no_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1623 unlet b:some_var |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1624 |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1625 w:some_var = 'some' |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1626 assert_equal('some', get(w:, 'some_var')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1627 assert_equal('some', get(w:, 'some_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1628 assert_equal('xxx', get(w:, 'no_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1629 unlet w:some_var |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1630 |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1631 t:some_var = 'some' |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1632 assert_equal('some', get(t:, 'some_var')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1633 assert_equal('some', get(t:, 'some_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1634 assert_equal('xxx', get(t:, 'no_var', 'xxx')) |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1635 unlet t:some_var |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1636 enddef |
5cb6e676defd
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents:
21393
diff
changeset
|
1637 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1638 def Test_expr7_parens() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1639 # (expr) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1640 assert_equal(4, (6 * 4) / 6) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1641 assert_equal(0, 6 * ( 4 / 6 )) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1642 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1643 assert_equal(6, +6) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1644 assert_equal(-6, -6) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1645 assert_equal(6, --6) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1646 assert_equal(6, -+-6) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1647 assert_equal(-6, ---6) |
21032
f80e822a310d
patch 8.2.1067: expression "!expr->func()" does not work
Bram Moolenaar <Bram@vim.org>
parents:
21028
diff
changeset
|
1648 assert_equal(false, !-3) |
f80e822a310d
patch 8.2.1067: expression "!expr->func()" does not work
Bram Moolenaar <Bram@vim.org>
parents:
21028
diff
changeset
|
1649 assert_equal(true, !+-+0) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1650 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1651 |
21044
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1652 def Test_expr7_parens_vim9script() |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1653 let lines =<< trim END |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1654 vim9script |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1655 let s = ( |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1656 'one' |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1657 .. |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1658 'two' |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1659 ) |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1660 assert_equal('onetwo', s) |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1661 END |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1662 CheckScriptSuccess(lines) |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1663 enddef |
dc2ca403a217
patch 8.2.1073: Vim9: no line break allowed in () expression
Bram Moolenaar <Bram@vim.org>
parents:
21040
diff
changeset
|
1664 |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1665 def Test_expr7_negate() |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1666 assert_equal(-99, -99) |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1667 assert_equal(99, --99) |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1668 let nr = 88 |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1669 assert_equal(-88, -nr) |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1670 assert_equal(88, --nr) |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1671 enddef |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1672 |
20029
8fb1cf4c44d5
patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents:
20013
diff
changeset
|
1673 def Echo(arg: any): string |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1674 return arg |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1675 enddef |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1676 |
20029
8fb1cf4c44d5
patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents:
20013
diff
changeset
|
1677 def s:EchoArg(arg: any): string |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1678 return arg |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1679 enddef |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1680 |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1681 def Test_expr7_call() |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1682 assert_equal('yes', 'yes'->Echo()) |
21455
8cc1555f2445
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21425
diff
changeset
|
1683 assert_equal('yes', 'yes' |
8cc1555f2445
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21425
diff
changeset
|
1684 ->s:EchoArg()) |
21032
f80e822a310d
patch 8.2.1067: expression "!expr->func()" does not work
Bram Moolenaar <Bram@vim.org>
parents:
21028
diff
changeset
|
1685 assert_equal(1, !range(5)->empty()) |
f80e822a310d
patch 8.2.1067: expression "!expr->func()" does not work
Bram Moolenaar <Bram@vim.org>
parents:
21028
diff
changeset
|
1686 assert_equal([0, 1, 2], --3->range()) |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1687 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1688 call CheckDefFailure(["let x = 'yes'->Echo"], 'E107:') |
19848
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1689 enddef |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1690 |
36d629aa3d6e
patch 8.2.0480: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19842
diff
changeset
|
1691 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1692 def Test_expr7_not() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1693 assert_equal(true, !'') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1694 assert_equal(true, ![]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1695 assert_equal(false, !'asdf') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1696 assert_equal(false, ![2]) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1697 assert_equal(true, !!'asdf') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1698 assert_equal(true, !![2]) |
19483
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1699 |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1700 assert_equal(true, !test_null_partial()) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1701 assert_equal(false, !{-> 'yes'}) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1702 |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1703 assert_equal(true, !test_null_dict()) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1704 assert_equal(true, !{}) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1705 assert_equal(false, !{'yes': 'no'}) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1706 |
19485
a09636ecee3c
patch 8.2.0300: Vim9: expression test fails without channel support
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1707 if has('channel') |
a09636ecee3c
patch 8.2.0300: Vim9: expression test fails without channel support
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1708 assert_equal(true, !test_null_job()) |
a09636ecee3c
patch 8.2.0300: Vim9: expression test fails without channel support
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1709 assert_equal(true, !test_null_channel()) |
a09636ecee3c
patch 8.2.0300: Vim9: expression test fails without channel support
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1710 endif |
19483
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1711 |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1712 assert_equal(true, !test_null_blob()) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1713 assert_equal(true, !0z) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1714 assert_equal(false, !0z01) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1715 |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1716 assert_equal(true, !test_void()) |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19469
diff
changeset
|
1717 assert_equal(true, !test_unknown()) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1718 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1719 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1720 func Test_expr7_fails() |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1721 call CheckDefFailure(["let x = (12"], "E110:") |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1722 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1723 call CheckDefFailure(["let x = -'xx'"], "E1030:") |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1724 call CheckDefFailure(["let x = +'xx'"], "E1030:") |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1725 call CheckDefFailure(["let x = -0z12"], "E974:") |
20287
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1726 call CheckDefExecFailure(["let x = -[8]"], "E39:") |
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1727 call CheckDefExecFailure(["let x = -{'a': 1}"], "E39:") |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1728 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1729 call CheckDefFailure(["let x = @"], "E1002:") |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1730 call CheckDefFailure(["let x = @<"], "E354:") |
19217
1235c26d9f04
patch 8.2.0167: Coverity warning for ignoring return value
Bram Moolenaar <Bram@vim.org>
parents:
19181
diff
changeset
|
1731 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1732 call CheckDefFailure(["let x = [1, 2"], "E697:") |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1733 call CheckDefFailure(["let x = [notfound]"], "E1001:") |
19826
293a22b677a8
patch 8.2.0469: Vim9: no error for missing ] after list
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
1734 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1735 call CheckDefFailure(["let x = { -> 123) }"], "E451:") |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1736 call CheckDefFailure(["let x = 123->{x -> x + 5) }"], "E451:") |
19826
293a22b677a8
patch 8.2.0469: Vim9: no error for missing ] after list
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
1737 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1738 call CheckDefFailure(["let x = ¬exist"], 'E113:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1739 call CheckDefFailure(["&grepprg = [343]"], 'E1013:') |
19451
b26e96f7c12f
patch 8.2.0283: Vim9: failing to load script var not tested
Bram Moolenaar <Bram@vim.org>
parents:
19449
diff
changeset
|
1740 |
20287
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1741 call CheckDefExecFailure(["echo s:doesnt_exist"], 'E121:') |
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1742 call CheckDefExecFailure(["echo g:doesnt_exist"], 'E121:') |
19469
55656a51d2af
patch 8.2.0292: Vim9: CHECKNR and CHECKTYPE instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19461
diff
changeset
|
1743 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1744 call CheckDefFailure(["echo a:somevar"], 'E1075:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1745 call CheckDefFailure(["echo l:somevar"], 'E1075:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1746 call CheckDefFailure(["echo x:somevar"], 'E1075:') |
19822
fc3cdc819d80
patch 8.2.0467: Vim9: some errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1747 |
20287
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1748 call CheckDefExecFailure(["let x = +g:astring"], 'E1030:') |
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1749 call CheckDefExecFailure(["let x = +g:ablob"], 'E974:') |
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1750 call CheckDefExecFailure(["let x = +g:alist"], 'E745:') |
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1751 call CheckDefExecFailure(["let x = +g:adict"], 'E728:') |
19558
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1752 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1753 call CheckDefFailure(["let x = ''", "let y = x.memb"], 'E715:') |
19822
fc3cdc819d80
patch 8.2.0467: Vim9: some errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1754 |
21465
b5d4ab124782
patch 8.2.1283: Vim9: error for misplaced -> lacks argument
Bram Moolenaar <Bram@vim.org>
parents:
21455
diff
changeset
|
1755 call CheckDefFailure(["'yes'->", "Echo()"], 'E488: Trailing characters: ->') |
21455
8cc1555f2445
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21425
diff
changeset
|
1756 |
21122
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21118
diff
changeset
|
1757 call CheckDefExecFailure(["[1, 2->len()"], 'E697:') |
20287
ce1b73835822
patch 8.2.0699: Vim9: not all errors tested
Bram Moolenaar <Bram@vim.org>
parents:
20207
diff
changeset
|
1758 call CheckDefExecFailure(["#{a: 1->len()"], 'E488:') |
21122
839ace6773aa
patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents:
21118
diff
changeset
|
1759 call CheckDefExecFailure(["{'a': 1->len()"], 'E723:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1760 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1761 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1762 let g:Funcrefs = [function('add')] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1763 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1764 func CallMe(arg) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1765 return a:arg |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1766 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1767 |
19437
5d34ae66118e
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Bram Moolenaar <Bram@vim.org>
parents:
19423
diff
changeset
|
1768 func CallMe2(one, two) |
5d34ae66118e
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Bram Moolenaar <Bram@vim.org>
parents:
19423
diff
changeset
|
1769 return a:one .. a:two |
5d34ae66118e
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Bram Moolenaar <Bram@vim.org>
parents:
19423
diff
changeset
|
1770 endfunc |
5d34ae66118e
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Bram Moolenaar <Bram@vim.org>
parents:
19423
diff
changeset
|
1771 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1772 def Test_expr7_trailing() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1773 # user function call |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1774 assert_equal(123, g:CallMe(123)) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1775 assert_equal(123, g:CallMe( 123)) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1776 assert_equal(123, g:CallMe(123 )) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1777 assert_equal('yesno', g:CallMe2('yes', 'no')) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1778 assert_equal('yesno', g:CallMe2( 'yes', 'no' )) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1779 assert_equal('nothing', g:CallMe('nothing')) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1780 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1781 # partial call |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1782 let Part = function('g:CallMe') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1783 assert_equal('yes', Part('yes')) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1784 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1785 # funcref call, using list index |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1786 let l = [] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1787 g:Funcrefs[0](l, 2) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1788 assert_equal([2], l) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1789 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1790 # method call |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1791 l = [2, 5, 6] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1792 l->map({k, v -> k + v}) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1793 assert_equal([2, 6, 8], l) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1794 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1795 # lambda method call |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1796 l = [2, 5] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1797 l->{l -> add(l, 8)}() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1798 assert_equal([2, 5, 8], l) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1799 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21313
diff
changeset
|
1800 # dict member |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1801 let d = #{key: 123} |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1802 assert_equal(123, d.key) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1803 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1804 |
21393
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1805 def Test_expr7_subscript() |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1806 let text = 'abcdef' |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1807 assert_equal('', text[-1]) |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1808 assert_equal('a', text[0]) |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1809 assert_equal('e', text[4]) |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1810 assert_equal('f', text[5]) |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1811 assert_equal('', text[6]) |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1812 enddef |
320581a133d9
patch 8.2.1247: Vim9: cannot index a character in a string
Bram Moolenaar <Bram@vim.org>
parents:
21387
diff
changeset
|
1813 |
20949
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1814 def Test_expr7_subscript_linebreak() |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1815 let range = range( |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1816 3) |
21455
8cc1555f2445
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21425
diff
changeset
|
1817 let l = range |
8cc1555f2445
patch 8.2.1278: Vim9: line break after "->" only allowed in :def function
Bram Moolenaar <Bram@vim.org>
parents:
21425
diff
changeset
|
1818 ->map('string(v:key)') |
20949
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1819 assert_equal(['0', '1', '2'], l) |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1820 |
20955
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1821 l = range |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1822 ->map('string(v:key)') |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1823 assert_equal(['0', '1', '2'], l) |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1824 |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1825 l = range # comment |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1826 ->map('string(v:key)') |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1827 assert_equal(['0', '1', '2'], l) |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1828 |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1829 l = range |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1830 |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1831 ->map('string(v:key)') |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1832 assert_equal(['0', '1', '2'], l) |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1833 |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1834 l = range |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1835 # comment |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1836 ->map('string(v:key)') |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1837 assert_equal(['0', '1', '2'], l) |
396fe712eb0f
patch 8.2.1029: Vim9: cannot chain function calls with -> at line start
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1838 |
20949
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1839 assert_equal('1', l[ |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1840 1]) |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1841 |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1842 let d = #{one: 33} |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1843 assert_equal(33, d. |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1844 one) |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1845 enddef |
62912ad41aff
patch 8.2.1026: Vim9: cannot break the line after "->"
Bram Moolenaar <Bram@vim.org>
parents:
20919
diff
changeset
|
1846 |
21232
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1847 def Test_expr7_method_call() |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1848 new |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1849 setline(1, ['first', 'last']) |
21544
6c67c86a202a
patch 8.2.1322: Vim9: method on double quoted string doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21512
diff
changeset
|
1850 'second'->append(1) |
6c67c86a202a
patch 8.2.1322: Vim9: method on double quoted string doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21512
diff
changeset
|
1851 "third"->append(2) |
6c67c86a202a
patch 8.2.1322: Vim9: method on double quoted string doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21512
diff
changeset
|
1852 assert_equal(['first', 'second', 'third', 'last'], getline(1, '$')) |
21232
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1853 bwipe! |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1854 |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1855 let bufnr = bufnr() |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1856 let loclist = [#{bufnr: bufnr, lnum: 42, col: 17, text: 'wrong'}] |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1857 loclist->setloclist(0) |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1858 assert_equal([#{bufnr: bufnr, |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1859 lnum: 42, |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1860 col: 17, |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1861 text: 'wrong', |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1862 pattern: '', |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1863 valid: 1, |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1864 vcol: 0, |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1865 nr: 0, |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1866 type: '', |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1867 module: ''} |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1868 ], getloclist(0)) |
3f14e0d4a4dd
patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents:
21216
diff
changeset
|
1869 enddef |
20029
8fb1cf4c44d5
patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents:
20013
diff
changeset
|
1870 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1871 func Test_expr7_trailing_fails() |
21313
e641f678bdb9
patch 8.2.1207: Vim9: crash in expr test when run in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21311
diff
changeset
|
1872 call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107') |
e641f678bdb9
patch 8.2.1207: Vim9: crash in expr test when run in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21311
diff
changeset
|
1873 call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)} ()'], 'E274') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1874 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1875 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1876 func Test_expr_fails() |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1877 call CheckDefFailure(["let x = '1'is2"], 'E488:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1878 call CheckDefFailure(["let x = '1'isnot2"], 'E488:') |
19437
5d34ae66118e
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Bram Moolenaar <Bram@vim.org>
parents:
19423
diff
changeset
|
1879 |
21210
44611891e22c
patch 8.2.1156: Vim9: No error for invalid command in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
21168
diff
changeset
|
1880 call CheckDefFailure(["CallMe ('yes')"], 'E476:') |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1881 call CheckDefFailure(["CallMe2('yes','no')"], 'E1069:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1882 call CheckDefFailure(["CallMe2('yes' , 'no')"], 'E1068:') |
19521
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19485
diff
changeset
|
1883 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1884 call CheckDefFailure(["v:nosuch += 3"], 'E1001:') |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20949
diff
changeset
|
1885 call CheckDefFailure(["let v:statusmsg = ''"], 'E1016: Cannot declare a v: variable:') |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1886 call CheckDefFailure(["let asdf = v:nosuch"], 'E1001:') |
19822
fc3cdc819d80
patch 8.2.0467: Vim9: some errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1887 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1888 call CheckDefFailure(["echo len('asdf'"], 'E110:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1889 call CheckDefFailure(["echo Func0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789()"], 'E1011:') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1890 call CheckDefFailure(["echo doesnotexist()"], 'E117:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1891 endfunc |