Mercurial > vim
annotate src/testdir/test_vim9_script.vim @ 20099:058b41f85bcb v8.2.0605
patch 8.2.0605: Vim9: cannot unlet an environment variable
Commit: https://github.com/vim/vim/commit/7bdaea6e0df849cf3dd7eaaf454eb88f637d1884
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 19 18:27:26 2020 +0200
patch 8.2.0605: Vim9: cannot unlet an environment variable
Problem: Vim9: cannot unlet an environment variable.
Solution: Implement unlet for $VAR.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 Apr 2020 18:30:04 +0200 |
parents | a64c16ff98b8 |
children | f40231487a49 |
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 " Test various aspects of the Vim9 script language. |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
19183
1168c53d1b49
patch 8.2.0150: cannot define python function when using :execute
Bram Moolenaar <Bram@vim.org>
parents:
19181
diff
changeset
|
3 source check.vim |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
4 source view_util.vim |
19183
1168c53d1b49
patch 8.2.0150: cannot define python function when using :execute
Bram Moolenaar <Bram@vim.org>
parents:
19181
diff
changeset
|
5 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 " Check that "lines" inside ":def" results in an "error" message. |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 func CheckDefFailure(lines, error) |
19185
17d878a2ddaa
patch 8.2.0151: detecting a script was already sourced is unreliable
Bram Moolenaar <Bram@vim.org>
parents:
19183
diff
changeset
|
8 call writefile(['def Func()'] + a:lines + ['enddef'], 'Xdef') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 call assert_fails('so Xdef', a:error, a:lines) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 call delete('Xdef') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
13 def CheckScriptFailure(lines: list<string>, error: string) |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
14 writefile(lines, 'Xdef') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
15 assert_fails('so Xdef', error, lines) |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
16 delete('Xdef') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
17 enddef |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
18 |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
19 def CheckScriptSuccess(lines: list<string>) |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
20 writefile(lines, 'Xdef') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
21 so Xdef |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
22 delete('Xdef') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
23 enddef |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 def Test_syntax() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 let var = 234 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 let other: list<string> = ['asdf'] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
30 let s:appendToMe = 'xxx' |
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
31 let s:addToMe = 111 |
19449
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
32 let g:existing = 'yes' |
19872
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
33 let g:inc_counter = 1 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
34 let $SOME_ENV_VAR = 'some' |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
35 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 def Test_assignment() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 let bool1: bool = true |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 assert_equal(v:true, bool1) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 let bool2: bool = false |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 assert_equal(v:false, bool2) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 |
19521
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
42 let list1: list<bool> = [false, true, false] |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 let list2: list<number> = [1, 2, 3] |
19521
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
44 let list3: list<string> = ['sdf', 'asdf'] |
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
45 let list4: list<any> = ['yes', true, 1234] |
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
46 let list5: list<blob> = [0z01, 0z02] |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 |
19467
f41e46f02c8c
patch 8.2.0291: Vim9: assigning [] to list<string> doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
19459
diff
changeset
|
48 let listS: list<string> = [] |
f41e46f02c8c
patch 8.2.0291: Vim9: assigning [] to list<string> doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
19459
diff
changeset
|
49 let listN: list<number> = [] |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 |
19521
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
51 let dict1: dict<bool> = #{one: false, two: true} |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 let dict2: dict<number> = #{one: 1, two: 2} |
19521
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
53 let dict3: dict<string> = #{key: 'value'} |
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
54 let dict4: dict<any> = #{one: 1, two: '2'} |
860b39ed0e0b
patch 8.2.0318: Vim9: types not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19511
diff
changeset
|
55 let dict5: dict<blob> = #{one: 0z01, tw: 0z02} |
19283
9dc843109c97
patch 8.2.0200: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19281
diff
changeset
|
56 |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
57 let a: number = 6 |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
58 assert_equal(6, a) |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
59 |
19558
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
60 if has('channel') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
61 let chan1: channel |
19564
06f29b6ea04a
patch 8.2.0339: Vim9: function return type may depend on arguments
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
62 let job1: job |
19572
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19568
diff
changeset
|
63 let job2: job = job_start('willfail') |
19558
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
64 endif |
19564
06f29b6ea04a
patch 8.2.0339: Vim9: function return type may depend on arguments
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
65 if has('float') |
06f29b6ea04a
patch 8.2.0339: Vim9: function return type may depend on arguments
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
66 let float1: float = 3.4 |
06f29b6ea04a
patch 8.2.0339: Vim9: function return type may depend on arguments
Bram Moolenaar <Bram@vim.org>
parents:
19558
diff
changeset
|
67 endif |
19912
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
68 let Funky1: func |
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
69 let Funky2: func = function('len') |
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
70 let Party2: func = funcref('Test_syntax') |
19558
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
71 |
20055
686deb5959c2
patch 8.2.0583: Vim9: # comment not recognized in :def function
Bram Moolenaar <Bram@vim.org>
parents:
20029
diff
changeset
|
72 # type becomes list<any> |
19579
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
73 let somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c'] |
20055
686deb5959c2
patch 8.2.0583: Vim9: # comment not recognized in :def function
Bram Moolenaar <Bram@vim.org>
parents:
20029
diff
changeset
|
74 # type becomes dict<any> |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
75 let somedict = rand() > 0 ? #{a: 1, b: 2} : #{a: 'a', b: 'b'} |
19579
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
76 |
19449
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
77 g:newvar = 'new' |
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
78 assert_equal('new', g:newvar) |
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
79 |
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
80 assert_equal('yes', g:existing) |
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
81 g:existing = 'no' |
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
82 assert_equal('no', g:existing) |
f8408ba21982
patch 8.2.0282: Vim9: setting number option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19445
diff
changeset
|
83 |
19283
9dc843109c97
patch 8.2.0200: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19281
diff
changeset
|
84 v:char = 'abc' |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
85 assert_equal('abc', v:char) |
19283
9dc843109c97
patch 8.2.0200: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19281
diff
changeset
|
86 |
9dc843109c97
patch 8.2.0200: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19281
diff
changeset
|
87 $ENVVAR = 'foobar' |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
88 assert_equal('foobar', $ENVVAR) |
19283
9dc843109c97
patch 8.2.0200: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19281
diff
changeset
|
89 $ENVVAR = '' |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
90 |
19451
b26e96f7c12f
patch 8.2.0283: Vim9: failing to load script var not tested
Bram Moolenaar <Bram@vim.org>
parents:
19449
diff
changeset
|
91 s:appendToMe ..= 'yyy' |
b26e96f7c12f
patch 8.2.0283: Vim9: failing to load script var not tested
Bram Moolenaar <Bram@vim.org>
parents:
19449
diff
changeset
|
92 assert_equal('xxxyyy', s:appendToMe) |
b26e96f7c12f
patch 8.2.0283: Vim9: failing to load script var not tested
Bram Moolenaar <Bram@vim.org>
parents:
19449
diff
changeset
|
93 s:addToMe += 222 |
b26e96f7c12f
patch 8.2.0283: Vim9: failing to load script var not tested
Bram Moolenaar <Bram@vim.org>
parents:
19449
diff
changeset
|
94 assert_equal(333, s:addToMe) |
19455
655631882288
patch 8.2.0285: unused error message; cannot create s:var
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
95 s:newVar = 'new' |
655631882288
patch 8.2.0285: unused error message; cannot create s:var
Bram Moolenaar <Bram@vim.org>
parents:
19451
diff
changeset
|
96 assert_equal('new', s:newVar) |
19872
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
97 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
98 set ts=7 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
99 &ts += 1 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
100 assert_equal(8, &ts) |
19878
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
101 &ts -= 3 |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
102 assert_equal(5, &ts) |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
103 &ts *= 2 |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
104 assert_equal(10, &ts) |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
105 &ts /= 3 |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
106 assert_equal(3, &ts) |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
107 set ts=10 |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
108 &ts %= 4 |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
109 assert_equal(2, &ts) |
19872
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
110 call CheckDefFailure(['¬ex += 3'], 'E113:') |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
111 call CheckDefFailure(['&ts ..= "xxx"'], 'E1019:') |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
112 call CheckDefFailure(['&path += 3'], 'E1013:') |
20055
686deb5959c2
patch 8.2.0583: Vim9: # comment not recognized in :def function
Bram Moolenaar <Bram@vim.org>
parents:
20029
diff
changeset
|
113 # test freeing ISN_STOREOPT |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
114 call CheckDefFailure(['&ts = 3', 'let asdf'], 'E1022:') |
19878
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
115 &ts = 8 |
19872
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
116 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
117 g:inc_counter += 1 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
118 assert_equal(2, g:inc_counter) |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
119 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
120 $SOME_ENV_VAR ..= 'more' |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
121 assert_equal('somemore', $SOME_ENV_VAR) |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
122 call CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1013:') |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
123 call CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1013:') |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
124 |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
125 @a = 'areg' |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
126 @a ..= 'add' |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
127 assert_equal('aregadd', @a) |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
128 call CheckDefFailure(['@a += "more"'], 'E1013:') |
8a7bede7b138
patch 8.2.0492: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
129 call CheckDefFailure(['@a += 123'], 'E1013:') |
19874
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
130 |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
131 v:errmsg = 'none' |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
132 v:errmsg ..= 'again' |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
133 assert_equal('noneagain', v:errmsg) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
134 call CheckDefFailure(['v:errmsg += "more"'], 'E1013:') |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
135 call CheckDefFailure(['v:errmsg += 123'], 'E1013:') |
19912
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
136 enddef |
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
137 |
20089
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
138 def Test_assignment_local() |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
139 " Test in a separated file in order not to the current buffer/window/tab is |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
140 " changed. |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
141 let script_lines: list<string> =<< trim END |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
142 let b:existing = 'yes' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
143 let w:existing = 'yes' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
144 let t:existing = 'yes' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
145 |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
146 def Test_assignment_local_internal() |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
147 b:newvar = 'new' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
148 assert_equal('new', b:newvar) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
149 assert_equal('yes', b:existing) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
150 b:existing = 'no' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
151 assert_equal('no', b:existing) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
152 |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
153 w:newvar = 'new' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
154 assert_equal('new', w:newvar) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
155 assert_equal('yes', w:existing) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
156 w:existing = 'no' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
157 assert_equal('no', w:existing) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
158 |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
159 t:newvar = 'new' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
160 assert_equal('new', t:newvar) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
161 assert_equal('yes', t:existing) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
162 t:existing = 'no' |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
163 assert_equal('no', t:existing) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
164 enddef |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
165 call Test_assignment_local_internal() |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
166 END |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
167 call CheckScriptSuccess(script_lines) |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
168 enddef |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
169 |
19912
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
170 def Test_assignment_default() |
19874
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
171 |
20055
686deb5959c2
patch 8.2.0583: Vim9: # comment not recognized in :def function
Bram Moolenaar <Bram@vim.org>
parents:
20029
diff
changeset
|
172 # Test default values. |
19874
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
173 let thebool: bool |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
174 assert_equal(v:false, thebool) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
175 |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
176 let thenumber: number |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
177 assert_equal(0, thenumber) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
178 |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
179 if has('float') |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
180 let thefloat: float |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
181 assert_equal(0.0, thefloat) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
182 endif |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
183 |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
184 let thestring: string |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
185 assert_equal('', thestring) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
186 |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
187 let theblob: blob |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
188 assert_equal(0z, theblob) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
189 |
19912
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
190 let Thefunc: func |
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
191 assert_equal(test_null_function(), Thefunc) |
19874
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
192 |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
193 let thelist: list<any> |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
194 assert_equal([], thelist) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
195 |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
196 let thedict: dict<any> |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
197 assert_equal({}, thedict) |
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
198 |
19890
2b117844f784
patch 8.2.0501: Vim9: script test fails when channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
19878
diff
changeset
|
199 if has('channel') |
2b117844f784
patch 8.2.0501: Vim9: script test fails when channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
19878
diff
changeset
|
200 let thejob: job |
2b117844f784
patch 8.2.0501: Vim9: script test fails when channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
19878
diff
changeset
|
201 assert_equal(test_null_job(), thejob) |
19874
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
202 |
19890
2b117844f784
patch 8.2.0501: Vim9: script test fails when channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
19878
diff
changeset
|
203 let thechannel: channel |
2b117844f784
patch 8.2.0501: Vim9: script test fails when channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
19878
diff
changeset
|
204 assert_equal(test_null_channel(), thechannel) |
2b117844f784
patch 8.2.0501: Vim9: script test fails when channel feature is missing
Bram Moolenaar <Bram@vim.org>
parents:
19878
diff
changeset
|
205 endif |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
206 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
207 let nr = 1234 | nr = 5678 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
208 assert_equal(5678, nr) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 |
19962
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
211 def Mess(): string |
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
212 v:foldstart = 123 |
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
213 return 'xxx' |
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
214 enddef |
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
215 |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
216 def Test_assignment_failure() |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 call CheckDefFailure(['let var=234'], 'E1004:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 call CheckDefFailure(['let var =234'], 'E1004:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 call CheckDefFailure(['let var= 234'], 'E1004:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 call CheckDefFailure(['let true = 1'], 'E1034:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 call CheckDefFailure(['let false = 1'], 'E1034:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
224 call CheckDefFailure(['let [a; b; c] = g:list'], 'E452:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
225 |
19874
f92435f0f449
patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19872
diff
changeset
|
226 call CheckDefFailure(['let somevar'], "E1022:") |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
227 call CheckDefFailure(['let &option'], 'E1052:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
228 call CheckDefFailure(['&g:option = 5'], 'E113:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
229 |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
230 call CheckDefFailure(['let $VAR = 5'], 'E1065:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
231 |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
232 call CheckDefFailure(['let @~ = 5'], 'E354:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
233 call CheckDefFailure(['let @a = 5'], 'E1066:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
234 |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
235 call CheckDefFailure(['let g:var = 5'], 'E1016:') |
20089
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
236 call CheckDefFailure(['let w:var = 5'], 'E1079:') |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
237 call CheckDefFailure(['let b:var = 5'], 'E1078:') |
7fc5d62fe2a5
patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents:
20079
diff
changeset
|
238 call CheckDefFailure(['let t:var = 5'], 'E1080:') |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
239 |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
240 call CheckDefFailure(['let anr = 4', 'anr ..= "text"'], 'E1019:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
241 call CheckDefFailure(['let xnr += 4'], 'E1020:') |
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
242 |
19822
fc3cdc819d80
patch 8.2.0467: Vim9: some errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19818
diff
changeset
|
243 call CheckScriptFailure(['vim9script', 'def Func()', 'let dummy = s:notfound', 'enddef'], 'E1050:') |
fc3cdc819d80
patch 8.2.0467: Vim9: some errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
19818
diff
changeset
|
244 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 call CheckDefFailure(['let var: list<string> = [123]'], 'expected list<string> but got list<number>') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 call CheckDefFailure(['let var: list<number> = ["xx"]'], 'expected list<number> but got list<string>') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 call CheckDefFailure(['let var: dict<string> = #{key: 123}'], 'expected dict<string> but got dict<number>') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 call CheckDefFailure(['let var: dict<number> = #{key: "xx"}'], 'expected dict<number> but got dict<string>') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 call CheckDefFailure(['let var = feedkeys("0")'], 'E1031:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 call CheckDefFailure(['let var: number = feedkeys("0")'], 'expected number but got void') |
19558
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
253 |
19904
bd4f91762d0f
patch 8.2.0508: Vim9: func and partial types not done yet
Bram Moolenaar <Bram@vim.org>
parents:
19894
diff
changeset
|
254 call CheckDefFailure(['let var: dict <number>'], 'E1068:') |
19558
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
255 call CheckDefFailure(['let var: dict<number'], 'E1009:') |
19962
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
256 |
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
257 call assert_fails('s/^/\=Mess()/n', 'E794:') |
12fa79cac39b
patch 8.2.0537: Vim9: no check for sandbox when setting v:var
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
258 call CheckDefFailure(['let var: dict<number'], 'E1009:') |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
259 enddef |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
260 |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
261 def Test_unlet() |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
262 g:somevar = 'yes' |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
263 assert_true(exists('g:somevar')) |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
264 unlet g:somevar |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
265 assert_false(exists('g:somevar')) |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
266 unlet! g:somevar |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
267 |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
268 call CheckScriptFailure([ |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
269 'vim9script', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
270 'let svar = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
271 'unlet svar', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
272 ], 'E1081:') |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
273 call CheckScriptFailure([ |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
274 'vim9script', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
275 'let svar = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
276 'unlet s:svar', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
277 ], 'E1081:') |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
278 call CheckScriptFailure([ |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
279 'vim9script', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
280 'let svar = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
281 'def Func()', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
282 ' unlet svar', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
283 'enddef', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
284 ], 'E1081:') |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
285 call CheckScriptFailure([ |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
286 'vim9script', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
287 'let svar = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
288 'def Func()', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
289 ' unlet s:svar', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
290 'enddef', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
291 ], 'E1081:') |
20099
058b41f85bcb
patch 8.2.0605: Vim9: cannot unlet an environment variable
Bram Moolenaar <Bram@vim.org>
parents:
20091
diff
changeset
|
292 |
058b41f85bcb
patch 8.2.0605: Vim9: cannot unlet an environment variable
Bram Moolenaar <Bram@vim.org>
parents:
20091
diff
changeset
|
293 $ENVVAR = 'foobar' |
058b41f85bcb
patch 8.2.0605: Vim9: cannot unlet an environment variable
Bram Moolenaar <Bram@vim.org>
parents:
20091
diff
changeset
|
294 assert_equal('foobar', $ENVVAR) |
058b41f85bcb
patch 8.2.0605: Vim9: cannot unlet an environment variable
Bram Moolenaar <Bram@vim.org>
parents:
20091
diff
changeset
|
295 unlet $ENVVAR |
058b41f85bcb
patch 8.2.0605: Vim9: cannot unlet an environment variable
Bram Moolenaar <Bram@vim.org>
parents:
20091
diff
changeset
|
296 assert_equal('', $ENVVAR) |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
297 enddef |
19818
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
298 |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
299 func Test_wrong_type() |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
300 call CheckDefFailure(['let var: list<nothing>'], 'E1010:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
301 call CheckDefFailure(['let var: list<list<nothing>>'], 'E1010:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
302 call CheckDefFailure(['let var: dict<nothing>'], 'E1010:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
303 call CheckDefFailure(['let var: dict<dict<nothing>>'], 'E1010:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
304 |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
305 call CheckDefFailure(['let var: dict<number'], 'E1009:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
306 call CheckDefFailure(['let var: dict<list<number>'], 'E1009:') |
19558
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
307 |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
308 call CheckDefFailure(['let var: ally'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
309 call CheckDefFailure(['let var: bram'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
310 call CheckDefFailure(['let var: cathy'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
311 call CheckDefFailure(['let var: dom'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
312 call CheckDefFailure(['let var: freddy'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
313 call CheckDefFailure(['let var: john'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
314 call CheckDefFailure(['let var: larry'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
315 call CheckDefFailure(['let var: ned'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
316 call CheckDefFailure(['let var: pam'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
317 call CheckDefFailure(['let var: sam'], 'E1010:') |
8eeec8886c02
patch 8.2.0336: Vim9: insufficient test coverage for compiling
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
318 call CheckDefFailure(['let var: vim'], 'E1010:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 func Test_const() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 call CheckDefFailure(['const var = 234', 'var = 99'], 'E1018:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 call CheckDefFailure(['const one = 234', 'let one = 99'], 'E1017:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 call CheckDefFailure(['const two'], 'E1021:') |
19860
37c4779ca8f5
patch 8.2.0486: Vim9: some code and error messages not tested
Bram Moolenaar <Bram@vim.org>
parents:
19822
diff
changeset
|
325 call CheckDefFailure(['const &option'], 'E996:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 def Test_block() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 let outer = 1 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 { |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 let inner = 2 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 assert_equal(1, outer) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 assert_equal(2, inner) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 } |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 assert_equal(1, outer) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 func Test_block_failure() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 call CheckDefFailure(['{', 'let inner = 1', '}', 'echo inner'], 'E1001:') |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
340 call CheckDefFailure(['}'], 'E1025:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
341 call CheckDefFailure(['{', 'echo 1'], 'E1026:') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
342 endfunc |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
344 def Test_cmd_modifier() |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
345 tab echo '0' |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
346 call CheckDefFailure(['5tab echo 3'], 'E16:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
347 enddef |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
348 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 def Test_try_catch() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 let l = [] |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
351 try # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 add(l, '1') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 throw 'wrong' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 add(l, '2') |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
355 catch # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 add(l, v:exception) |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
357 finally # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 add(l, '3') |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
359 endtry # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 assert_equal(['1', 'wrong', '3'], l) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
361 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
362 |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
363 def ThrowFromDef() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
364 throw 'getout' |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
365 enddef |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
366 |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
367 func CatchInFunc() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
368 try |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
369 call ThrowFromDef() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
370 catch |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
371 let g:thrown_func = v:exception |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
372 endtry |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
373 endfunc |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
374 |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
375 def CatchInDef() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
376 try |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
377 ThrowFromDef() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
378 catch |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
379 g:thrown_def = v:exception |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
380 endtry |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
381 enddef |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
382 |
19459
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
383 def ReturnFinally(): string |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
384 try |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
385 return 'intry' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
386 finally |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
387 g:in_finally = 'finally' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
388 endtry |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
389 return 'end' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
390 enddef |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
391 |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
392 def Test_try_catch_nested() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
393 CatchInFunc() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
394 assert_equal('getout', g:thrown_func) |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
395 |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
396 CatchInDef() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
397 assert_equal('getout', g:thrown_def) |
19459
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
398 |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
399 assert_equal('intry', ReturnFinally()) |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
400 assert_equal('finally', g:in_finally) |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
401 enddef |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
402 |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
403 def Test_try_catch_match() |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
404 let seq = 'a' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
405 try |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
406 throw 'something' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
407 catch /nothing/ |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
408 seq ..= 'x' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
409 catch /some/ |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
410 seq ..= 'b' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
411 catch /asdf/ |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
412 seq ..= 'x' |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
413 catch ?a\?sdf? |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
414 seq ..= 'y' |
19459
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
415 finally |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
416 seq ..= 'c' |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
417 endtry |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
418 assert_equal('abc', seq) |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
419 enddef |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
420 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
421 def Test_try_catch_fails() |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
422 call CheckDefFailure(['catch'], 'E603:') |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
423 call CheckDefFailure(['try', 'echo 0', 'catch','catch'], 'E1033:') |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
424 call CheckDefFailure(['try', 'echo 0', 'catch /pat'], 'E1067:') |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
425 call CheckDefFailure(['finally'], 'E606:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
426 call CheckDefFailure(['try', 'echo 0', 'finally', 'echo 1', 'finally'], 'E607:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
427 call CheckDefFailure(['endtry'], 'E602:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
428 call CheckDefFailure(['while 1', 'endtry'], 'E170:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
429 call CheckDefFailure(['for i in range(5)', 'endtry'], 'E170:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
430 call CheckDefFailure(['if 2', 'endtry'], 'E171:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
431 call CheckDefFailure(['try', 'echo 1', 'endtry'], 'E1032:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
432 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
433 call CheckDefFailure(['throw'], 'E471:') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
434 call CheckDefFailure(['throw xxx'], 'E1001:') |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
435 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
436 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 let s:export_script_lines =<< trim END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 vim9script |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 let name: string = 'bob' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 def Concat(arg: string): string |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 return name .. arg |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 let g:result = Concat('bie') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 let g:localname = name |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 export const CONST = 1234 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 export let exported = 9876 |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
448 export let exp_name = 'John' |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 export def Exported(): string |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 return 'Exported' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 |
19623
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
454 def Test_vim9_import_export() |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 let import_script_lines =<< trim END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 vim9script |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 import {exported, Exported} from './Xexport.vim' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 g:imported = exported |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
459 exported += 3 |
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
460 g:imported_added = exported |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 g:imported_func = Exported() |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
462 |
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
463 import {exp_name} from './Xexport.vim' |
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
464 g:imported_name = exp_name |
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
465 exp_name ..= ' Doe' |
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
466 g:imported_name_appended = exp_name |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
467 g:imported_later = exported |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 writefile(import_script_lines, 'Ximport.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 writefile(s:export_script_lines, 'Xexport.vim') |
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 source Ximport.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 assert_equal('bobbie', g:result) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 assert_equal('bob', g:localname) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 assert_equal(9876, g:imported) |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
478 assert_equal(9879, g:imported_added) |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
479 assert_equal(9879, g:imported_later) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 assert_equal('Exported', g:imported_func) |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
481 assert_equal('John', g:imported_name) |
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
482 assert_equal('John Doe', g:imported_name_appended) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 assert_false(exists('g:name')) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 unlet g:result |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 unlet g:localname |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 unlet g:imported |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
488 unlet g:imported_added |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
489 unlet g:imported_later |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 unlet g:imported_func |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
491 unlet g:imported_name g:imported_name_appended |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 delete('Ximport.vim') |
19509
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
493 |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
494 let import_in_def_lines =<< trim END |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
495 vim9script |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
496 def ImportInDef() |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
497 import exported from './Xexport.vim' |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
498 g:imported = exported |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
499 exported += 7 |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
500 g:imported_added = exported |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
501 enddef |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
502 ImportInDef() |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
503 END |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
504 writefile(import_in_def_lines, 'Ximport2.vim') |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
505 source Ximport2.vim |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
506 " TODO: this should be 9879 |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
507 assert_equal(9876, g:imported) |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
508 assert_equal(9883, g:imported_added) |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
509 unlet g:imported |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
510 unlet g:imported_added |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
511 delete('Ximport2.vim') |
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
512 |
19509
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
513 let import_star_as_lines =<< trim END |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
514 vim9script |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
515 import * as Export from './Xexport.vim' |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
516 def UseExport() |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
517 g:imported = Export.exported |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
518 enddef |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
519 UseExport() |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
520 END |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
521 writefile(import_star_as_lines, 'Ximport.vim') |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
522 source Ximport.vim |
19583
ba35daca6553
patch 8.2.0348: Vim9: not all code tested
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
523 assert_equal(9883, g:imported) |
19509
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
524 |
19818
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
525 let import_star_as_lines_no_dot =<< trim END |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
526 vim9script |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
527 import * as Export from './Xexport.vim' |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
528 def Func() |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
529 let dummy = 1 |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
530 let imported = Export + dummy |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
531 enddef |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
532 END |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
533 writefile(import_star_as_lines_no_dot, 'Ximport.vim') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
534 assert_fails('source Ximport.vim', 'E1060:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
535 |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
536 let import_star_as_lines_dot_space =<< trim END |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
537 vim9script |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
538 import * as Export from './Xexport.vim' |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
539 def Func() |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
540 let imported = Export . exported |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
541 enddef |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
542 END |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
543 writefile(import_star_as_lines_dot_space, 'Ximport.vim') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
544 assert_fails('source Ximport.vim', 'E1074:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
545 |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
546 let import_star_as_lines_missing_name =<< trim END |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
547 vim9script |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
548 import * as Export from './Xexport.vim' |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
549 def Func() |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
550 let imported = Export. |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
551 enddef |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
552 END |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
553 writefile(import_star_as_lines_missing_name, 'Ximport.vim') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
554 assert_fails('source Ximport.vim', 'E1048:') |
c1c88b333481
patch 8.2.0465: Vim9: dead code and wrong return type
Bram Moolenaar <Bram@vim.org>
parents:
19787
diff
changeset
|
555 |
19509
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
556 let import_star_lines =<< trim END |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
557 vim9script |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
558 import * from './Xexport.vim' |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
559 g:imported = exported |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
560 END |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
561 writefile(import_star_lines, 'Ximport.vim') |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
562 assert_fails('source Ximport.vim', 'E1045:') |
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
563 |
19511
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
564 " try to import something that exists but is not exported |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
565 let import_not_exported_lines =<< trim END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
566 vim9script |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
567 import name from './Xexport.vim' |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
568 END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
569 writefile(import_not_exported_lines, 'Ximport.vim') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
570 assert_fails('source Ximport.vim', 'E1049:') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
571 |
19623
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
572 " try to import something that is already defined |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
573 let import_already_defined =<< trim END |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
574 vim9script |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
575 let exported = 'something' |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
576 import exported from './Xexport.vim' |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
577 END |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
578 writefile(import_already_defined, 'Ximport.vim') |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
579 assert_fails('source Ximport.vim', 'E1073:') |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
580 |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
581 " try to import something that is already defined |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
582 import_already_defined =<< trim END |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
583 vim9script |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
584 let exported = 'something' |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
585 import * as exported from './Xexport.vim' |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
586 END |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
587 writefile(import_already_defined, 'Ximport.vim') |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
588 assert_fails('source Ximport.vim', 'E1073:') |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
589 |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
590 " try to import something that is already defined |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
591 import_already_defined =<< trim END |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
592 vim9script |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
593 let exported = 'something' |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
594 import {exported} from './Xexport.vim' |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
595 END |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
596 writefile(import_already_defined, 'Ximport.vim') |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
597 assert_fails('source Ximport.vim', 'E1073:') |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
598 |
19511
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
599 " import a very long name, requires making a copy |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
600 let import_long_name_lines =<< trim END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
601 vim9script |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
602 import name012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 from './Xexport.vim' |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
603 END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
604 writefile(import_long_name_lines, 'Ximport.vim') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
605 assert_fails('source Ximport.vim', 'E1048:') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
606 |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
607 let import_no_from_lines =<< trim END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
608 vim9script |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
609 import name './Xexport.vim' |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
610 END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
611 writefile(import_no_from_lines, 'Ximport.vim') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
612 assert_fails('source Ximport.vim', 'E1070:') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
613 |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
614 let import_invalid_string_lines =<< trim END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
615 vim9script |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
616 import name from Xexport.vim |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
617 END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
618 writefile(import_invalid_string_lines, 'Ximport.vim') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
619 assert_fails('source Ximport.vim', 'E1071:') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
620 |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
621 let import_wrong_name_lines =<< trim END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
622 vim9script |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
623 import name from './XnoExport.vim' |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
624 END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
625 writefile(import_wrong_name_lines, 'Ximport.vim') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
626 assert_fails('source Ximport.vim', 'E1053:') |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
627 |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
628 let import_missing_comma_lines =<< trim END |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
629 vim9script |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
630 import {exported name} from './Xexport.vim' |
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
631 END |
19623
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
632 writefile(import_missing_comma_lines, 'Ximport3.vim') |
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
633 assert_fails('source Ximport3.vim', 'E1046:') |
19511
7e76d5fba19f
patch 8.2.0313: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19509
diff
changeset
|
634 |
19509
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
635 delete('Ximport.vim') |
19623
2fee087c94cb
patch 8.2.0368: Vim9: import that redefines local variable does not fail
Bram Moolenaar <Bram@vim.org>
parents:
19593
diff
changeset
|
636 delete('Ximport3.vim') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
637 delete('Xexport.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 |
19507
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
639 " Check that in a Vim9 script 'cpo' is set to the Vim default. |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
640 set cpo&vi |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
641 let cpo_before = &cpo |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
642 let lines =<< trim END |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
643 vim9script |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
644 g:cpo_in_vim9script = &cpo |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
645 END |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
646 writefile(lines, 'Xvim9_script') |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
647 source Xvim9_script |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
648 assert_equal(cpo_before, &cpo) |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
649 set cpo&vim |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
650 assert_equal(&cpo, g:cpo_in_vim9script) |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
651 delete('Xvim9_script') |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
652 enddef |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
653 |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
654 def Test_vim9script_fails() |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:') |
19507
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
657 CheckScriptFailure(['export let some = 123'], 'E1042:') |
19509
17f0d6dc6a73
patch 8.2.0312: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19507
diff
changeset
|
658 CheckScriptFailure(['import some from "./Xexport.vim"'], 'E1042:') |
19507
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
659 CheckScriptFailure(['vim9script', 'export let g:some'], 'E1044:') |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
660 CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:') |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
661 |
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
662 assert_fails('vim9script', 'E1038') |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
663 assert_fails('export something', 'E1043') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 def Test_vim9script_reload() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 let lines =<< trim END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
668 vim9script |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
669 const var = '' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 let valone = 1234 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 def MyFunc(arg: string) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 valone = 5678 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 let morelines =<< trim END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
676 let valtwo = 222 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
677 export def GetValtwo(): number |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
678 return valtwo |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 END |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
681 writefile(lines + morelines, |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
682 'Xreload.vim') |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
683 source Xreload.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
684 source Xreload.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
685 source Xreload.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
686 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
687 let testlines =<< trim END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 vim9script |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 def TheFunc() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
690 import GetValtwo from './Xreload.vim' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
691 assert_equal(222, GetValtwo()) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
693 TheFunc() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
694 END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 writefile(testlines, 'Ximport.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
696 source Ximport.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
697 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
698 " test that when not using "morelines" valtwo is still defined |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
699 " need to source Xreload.vim again, import doesn't reload a script |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
700 writefile(lines, 'Xreload.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 source Xreload.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
702 source Ximport.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
703 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
704 " cannot declare a var twice |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
705 lines =<< trim END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
706 vim9script |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
707 let valone = 1234 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 let valone = 5678 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
709 END |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
710 writefile(lines, 'Xreload.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
711 assert_fails('source Xreload.vim', 'E1041:') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
712 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
713 delete('Xreload.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
714 delete('Ximport.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
715 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
716 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
717 def Test_import_absolute() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
718 let import_lines = [ |
20011
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
719 'vim9script', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
720 'import exported from "' .. escape(getcwd(), '\') .. '/Xexport_abs.vim"', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
721 'def UseExported()', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
722 ' g:imported_abs = exported', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
723 ' exported = 8888', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
724 ' g:imported_after = exported', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
725 'enddef', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
726 'UseExported()', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
727 'g:import_disassembled = execute("disass UseExported")', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
728 ] |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
729 writefile(import_lines, 'Ximport_abs.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
730 writefile(s:export_script_lines, 'Xexport_abs.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
731 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
732 source Ximport_abs.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
733 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
734 assert_equal(9876, g:imported_abs) |
19285
86665583dc83
patch 8.2.0201: cannot assign to an imported variable
Bram Moolenaar <Bram@vim.org>
parents:
19283
diff
changeset
|
735 assert_equal(8888, g:imported_after) |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
736 assert_match('<SNR>\d\+_UseExported.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
737 'g:imported_abs = exported.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
738 '0 LOADSCRIPT exported from .*Xexport_abs.vim.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
739 '1 STOREG g:imported_abs.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
740 'exported = 8888.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
741 '3 STORESCRIPT exported in .*Xexport_abs.vim.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
742 'g:imported_after = exported.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
743 '4 LOADSCRIPT exported from .*Xexport_abs.vim.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
744 '5 STOREG g:imported_after.*', |
20011
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
745 g:import_disassembled) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
746 unlet g:imported_abs |
19285
86665583dc83
patch 8.2.0201: cannot assign to an imported variable
Bram Moolenaar <Bram@vim.org>
parents:
19283
diff
changeset
|
747 unlet g:import_disassembled |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
748 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
749 delete('Ximport_abs.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
750 delete('Xexport_abs.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
751 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
752 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
753 def Test_import_rtp() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
754 let import_lines = [ |
20011
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
755 'vim9script', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
756 'import exported from "Xexport_rtp.vim"', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
757 'g:imported_rtp = exported', |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
758 ] |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
759 writefile(import_lines, 'Ximport_rtp.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
760 mkdir('import') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
761 writefile(s:export_script_lines, 'import/Xexport_rtp.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
762 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
763 let save_rtp = &rtp |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
764 &rtp = getcwd() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
765 source Ximport_rtp.vim |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
766 &rtp = save_rtp |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
767 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
768 assert_equal(9876, g:imported_rtp) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
769 unlet g:imported_rtp |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
770 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
771 delete('Ximport_rtp.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
772 delete('import/Xexport_rtp.vim') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
773 delete('import', 'd') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
774 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
775 |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
776 def Test_fixed_size_list() |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
777 " will be allocated as one piece of memory, check that changes work |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
778 let l = [1, 2, 3, 4] |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
779 l->remove(0) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
780 l->add(5) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
781 l->insert(99, 1) |
19281
9fcdeaa18bd1
patch 8.2.0199: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19253
diff
changeset
|
782 assert_equal([2, 99, 3, 4, 5], l) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
783 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
784 |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
785 def IfElse(what: number): string |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
786 let res = '' |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
787 if what == 1 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
788 res = "one" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
789 elseif what == 2 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
790 res = "two" |
19253
a8d2d3c8f0b3
patch 8.2.0185: Vim9 script: cannot use "if has()" to skip lines
Bram Moolenaar <Bram@vim.org>
parents:
19185
diff
changeset
|
791 else |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
792 res = "three" |
19253
a8d2d3c8f0b3
patch 8.2.0185: Vim9 script: cannot use "if has()" to skip lines
Bram Moolenaar <Bram@vim.org>
parents:
19185
diff
changeset
|
793 endif |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
794 return res |
19253
a8d2d3c8f0b3
patch 8.2.0185: Vim9 script: cannot use "if has()" to skip lines
Bram Moolenaar <Bram@vim.org>
parents:
19185
diff
changeset
|
795 enddef |
a8d2d3c8f0b3
patch 8.2.0185: Vim9 script: cannot use "if has()" to skip lines
Bram Moolenaar <Bram@vim.org>
parents:
19185
diff
changeset
|
796 |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
797 def Test_if_elseif_else() |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
798 assert_equal('one', IfElse(1)) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
799 assert_equal('two', IfElse(2)) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
800 assert_equal('three', IfElse(3)) |
19281
9fcdeaa18bd1
patch 8.2.0199: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19253
diff
changeset
|
801 enddef |
9fcdeaa18bd1
patch 8.2.0199: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19253
diff
changeset
|
802 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
803 def Test_if_elseif_else_fails() |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
804 call CheckDefFailure(['elseif true'], 'E582:') |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
805 call CheckDefFailure(['else'], 'E581:') |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
806 call CheckDefFailure(['endif'], 'E580:') |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
807 call CheckDefFailure(['if true', 'elseif xxx'], 'E1001:') |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
808 call CheckDefFailure(['if true', 'echo 1'], 'E171:') |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
809 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
810 |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
811 let g:bool_true = v:true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
812 let g:bool_false = v:false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
813 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
814 def Test_if_const_expr() |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
815 let res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
816 if true ? true : false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
817 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
818 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
819 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
820 |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
821 g:glob = 2 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
822 if false |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
823 execute('let g:glob = 3') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
824 endif |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
825 assert_equal(2, g:glob) |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
826 if true |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
827 execute('let g:glob = 3') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
828 endif |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
829 assert_equal(3, g:glob) |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
830 |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
831 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
832 if g:bool_true ? true : false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
833 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
834 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
835 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
836 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
837 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
838 if true ? g:bool_true : false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
839 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
840 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
841 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
842 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
843 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
844 if true ? true : g:bool_false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
845 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
846 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
847 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
848 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
849 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
850 if true ? false : true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
851 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
852 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
853 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
854 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
855 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
856 if false ? false : true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
857 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
858 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
859 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
860 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
861 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
862 if false ? true : false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
863 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
864 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
865 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
866 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
867 res = false |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
868 if has('xyz') ? true : false |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
869 res = true |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
870 endif |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
871 assert_equal(false, res) |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
872 |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
873 res = false |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
874 if true && true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
875 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
876 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
877 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
878 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
879 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
880 if true && false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
881 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
882 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
883 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
884 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
885 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
886 if g:bool_true && false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
887 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
888 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
889 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
890 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
891 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
892 if true && g:bool_false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
893 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
894 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
895 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
896 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
897 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
898 if false && false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
899 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
900 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
901 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
902 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
903 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
904 if true || false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
905 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
906 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
907 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
908 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
909 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
910 if g:bool_true || false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
911 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
912 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
913 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
914 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
915 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
916 if true || g:bool_false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
917 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
918 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
919 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
920 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
921 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
922 if false || false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
923 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
924 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
925 assert_equal(false, res) |
19878
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
926 enddef |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
927 |
19878
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
928 def Test_if_const_expr_fails() |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
929 call CheckDefFailure(['if "aaa" == "bbb'], 'E114:') |
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
930 call CheckDefFailure(["if 'aaa' == 'bbb"], 'E115:') |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
931 call CheckDefFailure(["if has('aaa'"], 'E110:') |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
932 call CheckDefFailure(["if has('aaa') ? true false"], 'E109:') |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
933 enddef |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
934 |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
935 def Test_execute_cmd() |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
936 new |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
937 setline(1, 'default') |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
938 execute 'call setline(1, "execute-string")' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
939 assert_equal('execute-string', getline(1)) |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
940 let cmd1 = 'call setline(1,' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
941 let cmd2 = '"execute-var")' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
942 execute cmd1 cmd2 |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
943 assert_equal('execute-var', getline(1)) |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
944 execute cmd1 cmd2 '|call setline(1, "execute-var-string")' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
945 assert_equal('execute-var-string', getline(1)) |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
946 let cmd_first = 'call ' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
947 let cmd_last = 'setline(1, "execute-var-var")' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
948 execute cmd_first .. cmd_last |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
949 assert_equal('execute-var-var', getline(1)) |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
950 bwipe! |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
951 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
952 call CheckDefFailure(['execute xxx'], 'E1001:') |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
953 enddef |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
954 |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
955 def Test_echo_cmd() |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
956 echo 'some' |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
957 echon 'thing' |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
958 assert_match('^something$', Screenline(&lines)) |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
959 |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
960 let str1 = 'some' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
961 let str2 = 'more' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
962 echo str1 str2 |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
963 assert_match('^some more$', Screenline(&lines)) |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
964 enddef |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
965 |
19568
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
966 def Test_for_outside_of_function() |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
967 let lines =<< trim END |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
968 vim9script |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
969 new |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
970 for var in range(0, 3) |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
971 append(line('$'), var) |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
972 endfor |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
973 assert_equal(['', '0', '1', '2', '3'], getline(1, '$')) |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
974 bwipe! |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
975 END |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
976 writefile(lines, 'Xvim9for.vim') |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
977 source Xvim9for.vim |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
978 delete('Xvim9for.vim') |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
979 enddef |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
980 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
981 def Test_for_loop() |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
982 let result = '' |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
983 for cnt in range(7) |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
984 if cnt == 4 |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
985 break |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
986 endif |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
987 if cnt == 2 |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
988 continue |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
989 endif |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
990 result ..= cnt .. '_' |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
991 endfor |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
992 assert_equal('0_1_3_', result) |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
993 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
994 |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
995 def Test_for_loop_fails() |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
996 CheckDefFailure(['for # in range(5)'], 'E690:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
997 CheckDefFailure(['for i In range(5)'], 'E690:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
998 CheckDefFailure(['let x = 5', 'for x in range(5)'], 'E1023:') |
20029
8fb1cf4c44d5
patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents:
20023
diff
changeset
|
999 CheckScriptFailure(['def Func(arg: any)', 'for arg in range(5)', 'enddef'], 'E1006:') |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1000 CheckDefFailure(['for i in "text"'], 'E1024:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1001 CheckDefFailure(['for i in xxx'], 'E1001:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1002 CheckDefFailure(['endfor'], 'E588:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1003 CheckDefFailure(['for i in range(3)', 'echo 3'], 'E170:') |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1004 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1005 |
19593
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1006 def Test_while_loop() |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1007 let result = '' |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1008 let cnt = 0 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1009 while cnt < 555 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1010 if cnt == 3 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1011 break |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1012 endif |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1013 cnt += 1 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1014 if cnt == 2 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1015 continue |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1016 endif |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1017 result ..= cnt .. '_' |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1018 endwhile |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1019 assert_equal('1_3_', result) |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1020 enddef |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
1021 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1022 def Test_while_loop_fails() |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1023 CheckDefFailure(['while xxx'], 'E1001:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1024 CheckDefFailure(['endwhile'], 'E588:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1025 CheckDefFailure(['continue'], 'E586:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1026 CheckDefFailure(['if true', 'continue'], 'E586:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1027 CheckDefFailure(['break'], 'E587:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1028 CheckDefFailure(['if true', 'break'], 'E587:') |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
20011
diff
changeset
|
1029 CheckDefFailure(['while 1', 'echo 3'], 'E170:') |
19862
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19860
diff
changeset
|
1030 enddef |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19860
diff
changeset
|
1031 |
19730
fe8ba2f82f59
patch 8.2.0421: interrupting with CTRL-C does not always work
Bram Moolenaar <Bram@vim.org>
parents:
19728
diff
changeset
|
1032 def Test_interrupt_loop() |
19736
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1033 let caught = false |
19730
fe8ba2f82f59
patch 8.2.0421: interrupting with CTRL-C does not always work
Bram Moolenaar <Bram@vim.org>
parents:
19728
diff
changeset
|
1034 let x = 0 |
19736
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1035 try |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1036 while 1 |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1037 x += 1 |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1038 if x == 100 |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1039 feedkeys("\<C-C>", 'Lt') |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1040 endif |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1041 endwhile |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1042 catch |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1043 caught = true |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1044 assert_equal(100, x) |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1045 endtry |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
1046 assert_true(caught, 'should have caught an exception') |
19730
fe8ba2f82f59
patch 8.2.0421: interrupting with CTRL-C does not always work
Bram Moolenaar <Bram@vim.org>
parents:
19728
diff
changeset
|
1047 enddef |
19726
ad37a198a708
patch 8.2.0419: various memory leaks in Vim9 script code
Bram Moolenaar <Bram@vim.org>
parents:
19623
diff
changeset
|
1048 |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1049 def Test_automatic_line_continuation() |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1050 let mylist = [ |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1051 'one', |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1052 'two', |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1053 'three', |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1054 ] " comment |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1055 assert_equal(['one', 'two', 'three'], mylist) |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1056 |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1057 let mydict = { |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1058 'one': 1, |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1059 'two': 2, |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1060 'three': |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1061 3, |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1062 } " comment |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1063 assert_equal({'one': 1, 'two': 2, 'three': 3}, mydict) |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1064 mydict = #{ |
20023
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1065 one: 1, # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1066 two: # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1067 2, # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1068 three: 3 # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1069 } |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1070 assert_equal(#{one: 1, two: 2, three: 3}, mydict) |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1071 mydict = #{ |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1072 one: 1, |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1073 two: |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1074 2, |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
1075 three: 3 |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1076 } |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1077 assert_equal(#{one: 1, two: 2, three: 3}, mydict) |
20011
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
1078 |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
1079 assert_equal( |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
1080 ['one', 'two', 'three'], |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
1081 split('one two three') |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
1082 ) |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1083 enddef |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
1084 |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1085 def Test_vim9_comment() |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1086 CheckScriptSuccess([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1087 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1088 '# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1089 ]) |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1090 CheckScriptFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1091 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1092 ':# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1093 ], 'E488:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1094 CheckScriptFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1095 '# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1096 ], 'E488:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1097 CheckScriptFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1098 ':# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1099 ], 'E488:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1100 |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1101 { # block start |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1102 } # block end |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1103 CheckDefFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1104 '{# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1105 ], 'E488:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1106 CheckDefFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1107 '{', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1108 '}# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1109 ], 'E488:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1110 |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1111 echo "yes" # comment |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1112 CheckDefFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1113 'echo "yes"# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1114 ], 'E488:') |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1115 CheckScriptSuccess([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1116 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1117 'echo "yes" # something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1118 ]) |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1119 CheckScriptFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1120 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1121 'echo "yes"# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1122 ], 'E121:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1123 CheckScriptFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1124 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1125 'echo# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1126 ], 'E121:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1127 CheckScriptFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1128 'echo "yes" # something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1129 ], 'E121:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1130 |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1131 exe "echo" # comment |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1132 CheckDefFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1133 'exe "echo"# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1134 ], 'E488:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1135 CheckScriptSuccess([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1136 'vim9script', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1137 'exe "echo" # something', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1138 ]) |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1139 CheckScriptFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1140 'vim9script', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1141 'exe "echo"# something', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1142 ], 'E121:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1143 CheckDefFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1144 'exe # comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1145 ], 'E1015:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1146 CheckScriptFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1147 'vim9script', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1148 'exe# something', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1149 ], 'E121:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1150 CheckScriptFailure([ |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1151 'exe "echo" # something', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1152 ], 'E121:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
1153 |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1154 CheckDefFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1155 'try# comment', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1156 'echo "yes"', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1157 'catch', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1158 'endtry', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1159 ], 'E488:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1160 CheckDefFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1161 'try', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1162 'echo "yes"', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1163 'catch# comment', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1164 'endtry', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1165 ], 'E488:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1166 CheckDefFailure([ |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1167 'try', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1168 'echo "yes"', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1169 'catch', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1170 'endtry# comment', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1171 ], 'E488:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1172 enddef |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
1173 |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1174 def Test_vim9_comment_not_compiled() |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1175 au TabEnter *.vim let g:entered = 1 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1176 au TabEnter *.x let g:entered = 2 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1177 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1178 edit test.vim |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1179 doautocmd TabEnter #comment |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1180 assert_equal(1, g:entered) |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1181 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1182 doautocmd TabEnter f.x |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1183 assert_equal(2, g:entered) |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1184 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1185 g:entered = 0 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1186 doautocmd TabEnter f.x #comment |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1187 assert_equal(2, g:entered) |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1188 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1189 assert_fails('doautocmd Syntax#comment', 'E216:') |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1190 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1191 au! TabEnter |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1192 unlet g:entered |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1193 |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1194 CheckScriptSuccess([ |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1195 'vim9script', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1196 'let g:var = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1197 'let w:var = 777', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1198 'unlet g:var w:var # something', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1199 ]) |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1200 |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1201 CheckScriptFailure([ |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1202 'vim9script', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1203 'let g:var = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1204 'unlet g:var# comment', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1205 ], 'E108:') |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1206 |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1207 CheckScriptFailure([ |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1208 'let g:var = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1209 'unlet g:var # something', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
1210 ], 'E488:') |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1211 enddef |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
1212 |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1213 " Keep this last, it messes up highlighting. |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1214 def Test_substitute_cmd() |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1215 new |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1216 setline(1, 'something') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1217 :substitute(some(other( |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1218 assert_equal('otherthing', getline(1)) |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1219 bwipe! |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1220 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1221 " also when the context is Vim9 script |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1222 let lines =<< trim END |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1223 vim9script |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1224 new |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1225 setline(1, 'something') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1226 :substitute(some(other( |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1227 assert_equal('otherthing', getline(1)) |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1228 bwipe! |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1229 END |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1230 writefile(lines, 'Xvim9lines') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1231 source Xvim9lines |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1232 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1233 delete('Xvim9lines') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1234 enddef |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1235 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1236 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |