Mercurial > vim
annotate src/testdir/test_vim9_script.vim @ 29224:ca46658481cf v8.2.5131
patch 8.2.5131: timeout implementation is not optimal
Commit: https://github.com/vim/vim/commit/e530395c2cd261d598094dc9ea785e90a753c5f1
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 19 17:05:47 2022 +0100
patch 8.2.5131: timeout implementation is not optimal
Problem: Timeout implementation is not optimal.
Solution: Further improvements for timeouts. Add a test for searchpair()
timeout. (partly by Paul Ollis)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 Jun 2022 18:15:03 +0200 |
parents | 11609f025219 |
children | fab3a46d0af7 |
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 |
20881
58137dbee8da
patch 8.2.0992: Vim9: crash when using :import in the Vim command
Bram Moolenaar <Bram@vim.org>
parents:
20871
diff
changeset
|
4 source term_util.vim |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
5 import './vim9.vim' as v9 |
27014
b861ae62860d
patch 8.2.4036: Vim9: script test file is getting too long
Bram Moolenaar <Bram@vim.org>
parents:
27002
diff
changeset
|
6 source screendump.vim |
21979
a98211c3e14e
patch 8.2.1539: using invalid script ID causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
21957
diff
changeset
|
7 source shared.vim |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 |
26873
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
9 def Test_vim9script_feature() |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
10 # example from the help, here the feature is always present |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
11 var lines =<< trim END |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
12 " old style comment |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
13 if !has('vim9script') |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
14 " legacy commands would go here |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
15 finish |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
16 endif |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
17 vim9script |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
18 # Vim9 script commands go here |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
19 g:didit = true |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
20 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
21 v9.CheckScriptSuccess(lines) |
26873
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
22 assert_equal(true, g:didit) |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
23 unlet g:didit |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
24 enddef |
be85735650f7
patch 8.2.3965: Vim9: no easy way to check if Vim9 script is supported
Bram Moolenaar <Bram@vim.org>
parents:
26745
diff
changeset
|
25 |
21901
1ebcce655dd3
patch 8.2.1500: Vim9: error when using address without a command
Bram Moolenaar <Bram@vim.org>
parents:
21883
diff
changeset
|
26 def Test_range_only() |
1ebcce655dd3
patch 8.2.1500: Vim9: error when using address without a command
Bram Moolenaar <Bram@vim.org>
parents:
21883
diff
changeset
|
27 new |
1ebcce655dd3
patch 8.2.1500: Vim9: error when using address without a command
Bram Moolenaar <Bram@vim.org>
parents:
21883
diff
changeset
|
28 setline(1, ['blah', 'Blah']) |
1ebcce655dd3
patch 8.2.1500: Vim9: error when using address without a command
Bram Moolenaar <Bram@vim.org>
parents:
21883
diff
changeset
|
29 :/Blah/ |
1ebcce655dd3
patch 8.2.1500: Vim9: error when using address without a command
Bram Moolenaar <Bram@vim.org>
parents:
21883
diff
changeset
|
30 assert_equal(2, getcurpos()[1]) |
21939
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
31 bwipe! |
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
32 |
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
33 # without range commands use current line |
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
34 new |
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
35 setline(1, ['one', 'two', 'three']) |
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
36 :2 |
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
37 print |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
38 assert_equal('two', g:Screenline(&lines)) |
21939
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
39 :3 |
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
40 list |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
41 assert_equal('three$', g:Screenline(&lines)) |
23954
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
42 |
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
43 # missing command does not print the line |
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
44 var lines =<< trim END |
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
45 vim9script |
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
46 :1| |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
47 assert_equal('three$', g:Screenline(&lines)) |
23954
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
48 :| |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
49 assert_equal('three$', g:Screenline(&lines)) |
23954
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
50 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
51 v9.CheckScriptSuccess(lines) |
23954
9c8a20cfa540
patch 8.2.2519: Vim9: no reason to keep strange Vi behavior
Bram Moolenaar <Bram@vim.org>
parents:
23950
diff
changeset
|
52 |
21939
8350bdbdbb28
patch 8.2.1519: Vim9: Ex command default range is not set
Bram Moolenaar <Bram@vim.org>
parents:
21937
diff
changeset
|
53 bwipe! |
23197
4ba101403fa2
patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents:
23185
diff
changeset
|
54 |
27768
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
55 lines =<< trim END |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
56 set cpo+=- |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
57 :1,999 |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
58 END |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
59 v9.CheckDefExecAndScriptFailure(lines, 'E16:', 2) |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
60 set cpo&vim |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
61 |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
62 v9.CheckDefExecAndScriptFailure([":'x"], 'E20:', 1) |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
63 |
23197
4ba101403fa2
patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents:
23185
diff
changeset
|
64 # won't generate anything |
4ba101403fa2
patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents:
23185
diff
changeset
|
65 if false |
4ba101403fa2
patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents:
23185
diff
changeset
|
66 :123 |
4ba101403fa2
patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents:
23185
diff
changeset
|
67 endif |
21901
1ebcce655dd3
patch 8.2.1500: Vim9: error when using address without a command
Bram Moolenaar <Bram@vim.org>
parents:
21883
diff
changeset
|
68 enddef |
1ebcce655dd3
patch 8.2.1500: Vim9: error when using address without a command
Bram Moolenaar <Bram@vim.org>
parents:
21883
diff
changeset
|
69 |
28694
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
70 def Test_invalid_range() |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
71 var lines =<< trim END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
72 :123 eval 1 + 2 |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
73 END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
74 v9.CheckDefAndScriptFailure(lines, 'E481:', 1) |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
75 |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
76 lines =<< trim END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
77 :123 if true |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
78 endif |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
79 END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
80 v9.CheckDefAndScriptFailure(lines, 'E481:', 1) |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
81 |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
82 lines =<< trim END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
83 :123 echo 'yes' |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
84 END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
85 v9.CheckDefAndScriptFailure(lines, 'E481:', 1) |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
86 |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
87 lines =<< trim END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
88 :123 cd there |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
89 END |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
90 v9.CheckDefAndScriptFailure(lines, 'E481:', 1) |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
91 enddef |
7f12fe85ed8b
patch 8.2.4871: Vim9: in :def function no error for misplaced range
Bram Moolenaar <Bram@vim.org>
parents:
28680
diff
changeset
|
92 |
20419
d54dfb5f12db
patch 8.2.0764: Vim9: assigning to option not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20401
diff
changeset
|
93 let g:alist = [7] |
d54dfb5f12db
patch 8.2.0764: Vim9: assigning to option not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20401
diff
changeset
|
94 let g:astring = 'text' |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
95 let g:anumber = 123 |
19326
d1810b726592
patch 8.2.0221: no test for Vim9 += and ..=
Bram Moolenaar <Bram@vim.org>
parents:
19320
diff
changeset
|
96 |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
97 def Test_delfunction() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
98 # Check function is defined in script namespace |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
99 v9.CheckScriptSuccess([ |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
100 'vim9script', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
101 'func CheckMe()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
102 ' return 123', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
103 'endfunc', |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
104 'func DoTest()', |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
105 ' call assert_equal(123, s:CheckMe())', |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
106 'endfunc', |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
107 'DoTest()', |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
108 ]) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
109 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
110 # Check function in script namespace cannot be deleted |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
111 v9.CheckScriptFailure([ |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
112 'vim9script', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
113 'func DeleteMe1()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
114 'endfunc', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
115 'delfunction DeleteMe1', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
116 ], 'E1084:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
117 v9.CheckScriptFailure([ |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
118 'vim9script', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
119 'func DeleteMe2()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
120 'endfunc', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
121 'def DoThat()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
122 ' delfunction DeleteMe2', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
123 'enddef', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
124 'DoThat()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
125 ], 'E1084:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
126 v9.CheckScriptFailure([ |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
127 'vim9script', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
128 'def DeleteMe3()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
129 'enddef', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
130 'delfunction DeleteMe3', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
131 ], 'E1084:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
132 v9.CheckScriptFailure([ |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
133 'vim9script', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
134 'def DeleteMe4()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
135 'enddef', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
136 'def DoThat()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
137 ' delfunction DeleteMe4', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
138 'enddef', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
139 'DoThat()', |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
140 ], 'E1084:') |
21479
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
141 |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
142 # Check that global :def function can be replaced and deleted |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
143 var lines =<< trim END |
21479
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
144 vim9script |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
145 def g:Global(): string |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
146 return "yes" |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
147 enddef |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
148 assert_equal("yes", g:Global()) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
149 def! g:Global(): string |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
150 return "no" |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
151 enddef |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
152 assert_equal("no", g:Global()) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
153 delfunc g:Global |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
154 assert_false(exists('*g:Global')) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
155 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
156 v9.CheckScriptSuccess(lines) |
21479
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
157 |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
158 # Check that global function can be replaced by a :def function and deleted |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
159 lines =<< trim END |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
160 vim9script |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
161 func g:Global() |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
162 return "yes" |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
163 endfunc |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
164 assert_equal("yes", g:Global()) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
165 def! g:Global(): string |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
166 return "no" |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
167 enddef |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
168 assert_equal("no", g:Global()) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
169 delfunc g:Global |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
170 assert_false(exists('*g:Global')) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
171 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
172 v9.CheckScriptSuccess(lines) |
21479
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
173 |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
174 # Check that global :def function can be replaced by a function and deleted |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
175 lines =<< trim END |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
176 vim9script |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
177 def g:Global(): string |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
178 return "yes" |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
179 enddef |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
180 assert_equal("yes", g:Global()) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
181 func! g:Global() |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
182 return "no" |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
183 endfunc |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
184 assert_equal("no", g:Global()) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
185 delfunc g:Global |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
186 assert_false(exists('*g:Global')) |
90d859a402cc
patch 8.2.1290: Vim9: cannot replace a global function
Bram Moolenaar <Bram@vim.org>
parents:
21473
diff
changeset
|
187 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
188 v9.CheckScriptSuccess(lines) |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
189 enddef |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
190 |
22264
e0a4d029cb87
patch 8.2.1681: Vim9: unnessary :call commands in tests
Bram Moolenaar <Bram@vim.org>
parents:
22250
diff
changeset
|
191 def Test_wrong_type() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
192 v9.CheckDefFailure(['var name: list<nothing>'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
193 v9.CheckDefFailure(['var name: list<list<nothing>>'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
194 v9.CheckDefFailure(['var name: dict<nothing>'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
195 v9.CheckDefFailure(['var name: dict<dict<nothing>>'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
196 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
197 v9.CheckDefFailure(['var name: dict<number'], 'E1009:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
198 v9.CheckDefFailure(['var name: dict<list<number>'], 'E1009:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
199 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
200 v9.CheckDefFailure(['var name: ally'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
201 v9.CheckDefFailure(['var name: bram'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
202 v9.CheckDefFailure(['var name: cathy'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
203 v9.CheckDefFailure(['var name: dom'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
204 v9.CheckDefFailure(['var name: freddy'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
205 v9.CheckDefFailure(['var name: john'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
206 v9.CheckDefFailure(['var name: larry'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
207 v9.CheckDefFailure(['var name: ned'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
208 v9.CheckDefFailure(['var name: pam'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
209 v9.CheckDefFailure(['var name: sam'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
210 v9.CheckDefFailure(['var name: vim'], 'E1010:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
211 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
212 v9.CheckDefFailure(['var Ref: number', 'Ref()'], 'E1085:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
213 v9.CheckDefFailure(['var Ref: string', 'var res = Ref()'], 'E1085:') |
22264
e0a4d029cb87
patch 8.2.1681: Vim9: unnessary :call commands in tests
Bram Moolenaar <Bram@vim.org>
parents:
22250
diff
changeset
|
214 enddef |
e0a4d029cb87
patch 8.2.1681: Vim9: unnessary :call commands in tests
Bram Moolenaar <Bram@vim.org>
parents:
22250
diff
changeset
|
215 |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
216 def Test_script_namespace() |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
217 # defining a function or variable with s: is not allowed |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
218 var lines =<< trim END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
219 vim9script |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
220 def s:Function() |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
221 enddef |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
222 END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
223 v9.CheckScriptFailure(lines, 'E1268:') |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
224 |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
225 for decl in ['var', 'const', 'final'] |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
226 lines =<< trim END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
227 vim9script |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
228 var s:var = 'var' |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
229 END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
230 v9.CheckScriptFailure([ |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
231 'vim9script', |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
232 decl .. ' s:var = "var"', |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
233 ], 'E1268:') |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
234 endfor |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
235 |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
236 # Calling a function or using a variable with s: is not allowed at script |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
237 # level |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
238 lines =<< trim END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
239 vim9script |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
240 def Function() |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
241 enddef |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
242 s:Function() |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
243 END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
244 v9.CheckScriptFailure(lines, 'E1268:') |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
245 lines =<< trim END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
246 vim9script |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
247 def Function() |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
248 enddef |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
249 call s:Function() |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
250 END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
251 v9.CheckScriptFailure(lines, 'E1268:') |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
252 lines =<< trim END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
253 vim9script |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
254 var var = 'var' |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
255 echo s:var |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
256 END |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
257 v9.CheckScriptFailure(lines, 'E1268:') |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
258 enddef |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
259 |
22529
35ef9b0a81a3
patch 8.2.1813: Vim9: can assign wrong type to script dict
Bram Moolenaar <Bram@vim.org>
parents:
22500
diff
changeset
|
260 def Test_script_wrong_type() |
35ef9b0a81a3
patch 8.2.1813: Vim9: can assign wrong type to script dict
Bram Moolenaar <Bram@vim.org>
parents:
22500
diff
changeset
|
261 var lines =<< trim END |
35ef9b0a81a3
patch 8.2.1813: Vim9: can assign wrong type to script dict
Bram Moolenaar <Bram@vim.org>
parents:
22500
diff
changeset
|
262 vim9script |
27669
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
263 var dict: dict<string> |
5c4ab8d4472c
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Bram Moolenaar <Bram@vim.org>
parents:
27665
diff
changeset
|
264 dict['a'] = ['x'] |
22529
35ef9b0a81a3
patch 8.2.1813: Vim9: can assign wrong type to script dict
Bram Moolenaar <Bram@vim.org>
parents:
22500
diff
changeset
|
265 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
266 v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected string but got list<string>', 3) |
22529
35ef9b0a81a3
patch 8.2.1813: Vim9: can assign wrong type to script dict
Bram Moolenaar <Bram@vim.org>
parents:
22500
diff
changeset
|
267 enddef |
35ef9b0a81a3
patch 8.2.1813: Vim9: can assign wrong type to script dict
Bram Moolenaar <Bram@vim.org>
parents:
22500
diff
changeset
|
268 |
22264
e0a4d029cb87
patch 8.2.1681: Vim9: unnessary :call commands in tests
Bram Moolenaar <Bram@vim.org>
parents:
22250
diff
changeset
|
269 def Test_const() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
270 v9.CheckDefFailure(['final name = 234', 'name = 99'], 'E1018:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
271 v9.CheckDefFailure(['final one = 234', 'var one = 99'], 'E1017:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
272 v9.CheckDefFailure(['final list = [1, 2]', 'var list = [3, 4]'], 'E1017:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
273 v9.CheckDefFailure(['final two'], 'E1125:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
274 v9.CheckDefFailure(['final &option'], 'E996:') |
22266
23f5750146d9
patch 8.2.1682: Vim9: const works in an unexpected way
Bram Moolenaar <Bram@vim.org>
parents:
22264
diff
changeset
|
275 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
276 var lines =<< trim END |
22391
a9fb7efa31d6
patch 8.2.1744: Vim9: using ":const!" is weird
Bram Moolenaar <Bram@vim.org>
parents:
22387
diff
changeset
|
277 final list = [1, 2, 3] |
22266
23f5750146d9
patch 8.2.1682: Vim9: const works in an unexpected way
Bram Moolenaar <Bram@vim.org>
parents:
22264
diff
changeset
|
278 list[0] = 4 |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
279 list->assert_equal([4, 2, 3]) |
22391
a9fb7efa31d6
patch 8.2.1744: Vim9: using ":const!" is weird
Bram Moolenaar <Bram@vim.org>
parents:
22387
diff
changeset
|
280 const other = [5, 6, 7] |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
281 other->assert_equal([5, 6, 7]) |
22274
1634ca41e4d3
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
22272
diff
changeset
|
282 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
283 var varlist = [7, 8] |
22391
a9fb7efa31d6
patch 8.2.1744: Vim9: using ":const!" is weird
Bram Moolenaar <Bram@vim.org>
parents:
22387
diff
changeset
|
284 const constlist = [1, varlist, 3] |
22274
1634ca41e4d3
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
22272
diff
changeset
|
285 varlist[0] = 77 |
25489
911fdca7f736
patch 8.2.3281: Vim9: TODO items in tests can be taken care of
Bram Moolenaar <Bram@vim.org>
parents:
25469
diff
changeset
|
286 constlist[1][1] = 88 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
287 var cl = constlist[1] |
22274
1634ca41e4d3
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
22272
diff
changeset
|
288 cl[1] = 88 |
1634ca41e4d3
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
22272
diff
changeset
|
289 constlist->assert_equal([1, [77, 88], 3]) |
1634ca41e4d3
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
22272
diff
changeset
|
290 |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
291 var vardict = {five: 5, six: 6} |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
292 const constdict = {one: 1, two: vardict, three: 3} |
22274
1634ca41e4d3
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
22272
diff
changeset
|
293 vardict['five'] = 55 |
25489
911fdca7f736
patch 8.2.3281: Vim9: TODO items in tests can be taken care of
Bram Moolenaar <Bram@vim.org>
parents:
25469
diff
changeset
|
294 constdict['two']['six'] = 66 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
295 var cd = constdict['two'] |
22274
1634ca41e4d3
patch 8.2.1686: Vim9: "const!" not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
22272
diff
changeset
|
296 cd['six'] = 66 |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
297 constdict->assert_equal({one: 1, two: {five: 55, six: 66}, three: 3}) |
22266
23f5750146d9
patch 8.2.1682: Vim9: const works in an unexpected way
Bram Moolenaar <Bram@vim.org>
parents:
22264
diff
changeset
|
298 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
299 v9.CheckDefAndScriptSuccess(lines) |
22264
e0a4d029cb87
patch 8.2.1681: Vim9: unnessary :call commands in tests
Bram Moolenaar <Bram@vim.org>
parents:
22250
diff
changeset
|
300 enddef |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
302 def Test_const_bang() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
303 var lines =<< trim END |
22391
a9fb7efa31d6
patch 8.2.1744: Vim9: using ":const!" is weird
Bram Moolenaar <Bram@vim.org>
parents:
22387
diff
changeset
|
304 const var = 234 |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
305 var = 99 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
306 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
307 v9.CheckDefExecFailure(lines, 'E1018:', 2) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
308 v9.CheckScriptFailure(['vim9script'] + lines, 'E46:', 3) |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
309 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
310 lines =<< trim END |
22391
a9fb7efa31d6
patch 8.2.1744: Vim9: using ":const!" is weird
Bram Moolenaar <Bram@vim.org>
parents:
22387
diff
changeset
|
311 const ll = [2, 3, 4] |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
312 ll[0] = 99 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
313 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
314 v9.CheckDefExecFailure(lines, 'E1119:', 2) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
315 v9.CheckScriptFailure(['vim9script'] + lines, 'E741:', 3) |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
316 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
317 lines =<< trim END |
22391
a9fb7efa31d6
patch 8.2.1744: Vim9: using ":const!" is weird
Bram Moolenaar <Bram@vim.org>
parents:
22387
diff
changeset
|
318 const ll = [2, 3, 4] |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
319 ll[3] = 99 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
320 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
321 v9.CheckDefExecFailure(lines, 'E1118:', 2) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
322 v9.CheckScriptFailure(['vim9script'] + lines, 'E684:', 3) |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
323 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
324 lines =<< trim END |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
325 const dd = {one: 1, two: 2} |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
326 dd["one"] = 99 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
327 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
328 v9.CheckDefExecFailure(lines, 'E1121:', 2) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
329 v9.CheckScriptFailure(['vim9script'] + lines, 'E741:', 3) |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
330 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
331 lines =<< trim END |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
332 const dd = {one: 1, two: 2} |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
333 dd["three"] = 99 |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
334 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
335 v9.CheckDefExecFailure(lines, 'E1120:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
336 v9.CheckScriptFailure(['vim9script'] + lines, 'E741:', 3) |
22272
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
337 enddef |
eb1f5f618c75
patch 8.2.1685: Vim9: cannot declare a constant value
Bram Moolenaar <Bram@vim.org>
parents:
22266
diff
changeset
|
338 |
20982
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
339 def Test_range_no_colon() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
340 v9.CheckDefFailure(['%s/a/b/'], 'E1050:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
341 v9.CheckDefFailure(['+ s/a/b/'], 'E1050:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
342 v9.CheckDefFailure(['- s/a/b/'], 'E1050:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
343 v9.CheckDefFailure(['. s/a/b/'], 'E1050:') |
20982
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
344 enddef |
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
345 |
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
346 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 def Test_block() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
348 var outer = 1 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 { |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
350 var inner = 2 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 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
|
352 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
|
353 } |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 assert_equal(1, outer) |
24027
8298c0798040
patch 8.2.2555: Vim9: missing test for 8.2.2553
Bram Moolenaar <Bram@vim.org>
parents:
24025
diff
changeset
|
355 |
8298c0798040
patch 8.2.2555: Vim9: missing test for 8.2.2553
Bram Moolenaar <Bram@vim.org>
parents:
24025
diff
changeset
|
356 {|echo 'yes'|} |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 |
22264
e0a4d029cb87
patch 8.2.1681: Vim9: unnessary :call commands in tests
Bram Moolenaar <Bram@vim.org>
parents:
22250
diff
changeset
|
359 def Test_block_failure() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
360 v9.CheckDefFailure(['{', 'var inner = 1', '}', 'echo inner'], 'E1001:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
361 v9.CheckDefFailure(['}'], 'E1025:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
362 v9.CheckDefFailure(['{', 'echo 1'], 'E1026:') |
22264
e0a4d029cb87
patch 8.2.1681: Vim9: unnessary :call commands in tests
Bram Moolenaar <Bram@vim.org>
parents:
22250
diff
changeset
|
363 enddef |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
364 |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
365 def Test_block_local_vars() |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
366 var lines =<< trim END |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
367 vim9script |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
368 v:testing = 1 |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
369 if true |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
370 var text = ['hello'] |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
371 def SayHello(): list<string> |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
372 return text |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
373 enddef |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
374 def SetText(v: string) |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
375 text = [v] |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
376 enddef |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
377 endif |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
378 |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
379 if true |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
380 var text = ['again'] |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
381 def SayAgain(): list<string> |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
382 return text |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
383 enddef |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
384 endif |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
385 |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
386 # test that the "text" variables are not cleaned up |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
387 test_garbagecollect_now() |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
388 |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
389 defcompile |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
390 |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
391 assert_equal(['hello'], SayHello()) |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
392 assert_equal(['again'], SayAgain()) |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
393 |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
394 SetText('foobar') |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
395 assert_equal(['foobar'], SayHello()) |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
396 |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
397 call writefile(['ok'], 'Xdidit') |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
398 qall! |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
399 END |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
400 |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
401 # need to execute this with a separate Vim instance to avoid the current |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
402 # context gets garbage collected. |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
403 writefile(lines, 'Xscript') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
404 g:RunVim([], [], '-S Xscript') |
22602
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
405 assert_equal(['ok'], readfile('Xdidit')) |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
406 |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
407 delete('Xscript') |
2c77ec32deeb
patch 8.2.1849: Vim9: garbage collection frees block-local variables
Bram Moolenaar <Bram@vim.org>
parents:
22596
diff
changeset
|
408 delete('Xdidit') |
22596
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
409 enddef |
107eae953b87
patch 8.2.1846: Vim9: block variables are not found in compiled function
Bram Moolenaar <Bram@vim.org>
parents:
22555
diff
changeset
|
410 |
22643
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
411 def Test_block_local_vars_with_func() |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
412 var lines =<< trim END |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
413 vim9script |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
414 if true |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
415 var foo = 'foo' |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
416 if true |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
417 var bar = 'bar' |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
418 def Func(): list<string> |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
419 return [foo, bar] |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
420 enddef |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
421 endif |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
422 endif |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
423 # function is compiled here, after blocks have finished, can still access |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
424 # "foo" and "bar" |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
425 assert_equal(['foo', 'bar'], Func()) |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
426 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
427 v9.CheckScriptSuccess(lines) |
22643
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
428 enddef |
71b57779177d
patch 8.2.1870: Vim9: no need to keep all script variables
Bram Moolenaar <Bram@vim.org>
parents:
22621
diff
changeset
|
429 |
25469
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
430 " legacy func for command that's defined later |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
431 func s:InvokeSomeCommand() |
25469
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
432 SomeCommand |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
433 endfunc |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
434 |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
435 def Test_autocommand_block() |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
436 com SomeCommand { |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
437 g:someVar = 'some' |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
438 } |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
439 InvokeSomeCommand() |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
440 assert_equal('some', g:someVar) |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
441 |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
442 delcommand SomeCommand |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
443 unlet g:someVar |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
444 enddef |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
445 |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
446 def Test_command_block() |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
447 au BufNew *.xml { |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
448 g:otherVar = 'other' |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
449 } |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
450 split other.xml |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
451 assert_equal('other', g:otherVar) |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
452 |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
453 bwipe! |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
454 au! BufNew *.xml |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
455 unlet g:otherVar |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
456 enddef |
dcd45fe7fe2e
patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function
Bram Moolenaar <Bram@vim.org>
parents:
25425
diff
changeset
|
457 |
21375
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
458 func g:NoSuchFunc() |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
459 echo 'none' |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
460 endfunc |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
461 |
23576
4cd173b3d572
patch 8.2.2330: Vim9: crash when using :trow in a not executed block
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
462 def Test_try_catch_throw() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
463 var l = [] |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
464 try # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 add(l, '1') |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 throw 'wrong' |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 add(l, '2') |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
468 catch # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 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
|
470 finally # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 add(l, '3') |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
472 endtry # comment |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 assert_equal(['1', 'wrong', '3'], l) |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
474 |
21371
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
475 l = [] |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
476 try |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
477 try |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
478 add(l, '1') |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
479 throw 'wrong' |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
480 add(l, '2') |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
481 catch /right/ |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
482 add(l, v:exception) |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
483 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
484 catch /wrong/ |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
485 add(l, 'caught') |
27970
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
486 finally |
21371
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
487 add(l, 'finally') |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
488 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
489 assert_equal(['1', 'caught', 'finally'], l) |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
490 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
491 var n: number |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
492 try |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
493 n = l[3] |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
494 catch /E684:/ |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
495 n = 99 |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
496 endtry |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
497 assert_equal(99, n) |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
498 |
23440
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
499 var done = 'no' |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
500 if 0 |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
501 try | catch | endtry |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
502 else |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
503 done = 'yes' |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
504 endif |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
505 assert_equal('yes', done) |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
506 |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
507 done = 'no' |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
508 if 1 |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
509 done = 'yes' |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
510 else |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
511 try | catch | endtry |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
512 done = 'never' |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
513 endif |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
514 assert_equal('yes', done) |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
515 |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
516 if 1 |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
517 else |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
518 try | catch /pat/ | endtry |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
519 try | catch /pat/ |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
520 endtry |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
521 try |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
522 catch /pat/ | endtry |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
523 try |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
524 catch /pat/ |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
525 endtry |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
526 endif |
b0587f7ec422
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
23428
diff
changeset
|
527 |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
528 try |
21833
e3f9528bddda
patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents:
21831
diff
changeset
|
529 # string slice returns a string, not a number |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
530 n = g:astring[3] |
22284
6b385c2b9ff5
patch 8.2.1691: Vim9: list<any> is not accepted where list<number> is expected
Bram Moolenaar <Bram@vim.org>
parents:
22274
diff
changeset
|
531 catch /E1012:/ |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
532 n = 77 |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
533 endtry |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
534 assert_equal(77, n) |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
535 |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
536 try |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
537 n = l[g:astring] |
22284
6b385c2b9ff5
patch 8.2.1691: Vim9: list<any> is not accepted where list<number> is expected
Bram Moolenaar <Bram@vim.org>
parents:
22274
diff
changeset
|
538 catch /E1012:/ |
21831
d8422de73113
patch 8.2.1465: Vim9: subscript not handled properly
Bram Moolenaar <Bram@vim.org>
parents:
21821
diff
changeset
|
539 n = 88 |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
540 endtry |
21831
d8422de73113
patch 8.2.1465: Vim9: subscript not handled properly
Bram Moolenaar <Bram@vim.org>
parents:
21821
diff
changeset
|
541 assert_equal(88, n) |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
542 |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
543 try |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
544 n = s:does_not_exist |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
545 catch /E121:/ |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
546 n = 111 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
547 endtry |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
548 assert_equal(111, n) |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
549 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
550 try |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
551 n = g:does_not_exist |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
552 catch /E121:/ |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
553 n = 121 |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
554 endtry |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
555 assert_equal(121, n) |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
556 |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
557 var d = {one: 1} |
21359
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
558 try |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
559 n = d[g:astring] |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
560 catch /E716:/ |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
561 n = 222 |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
562 endtry |
e3711ce8133b
patch 8.2.1230: Vim9: list index error not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21353
diff
changeset
|
563 assert_equal(222, n) |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
564 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
565 try |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
566 n = -g:astring |
25634
27cb2e79ccde
patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25551
diff
changeset
|
567 catch /E1012:/ |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
568 n = 233 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
569 endtry |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
570 assert_equal(233, n) |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
571 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
572 try |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
573 n = +g:astring |
25634
27cb2e79ccde
patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25551
diff
changeset
|
574 catch /E1012:/ |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
575 n = 244 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
576 endtry |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
577 assert_equal(244, n) |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
578 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
579 try |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
580 n = +g:alist |
25634
27cb2e79ccde
patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25551
diff
changeset
|
581 catch /E1012:/ |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
582 n = 255 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
583 endtry |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
584 assert_equal(255, n) |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
585 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
586 var nd: dict<any> |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
587 try |
23827
7e0d8f1cae7d
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
23790
diff
changeset
|
588 nd = {[g:alist]: 1} |
7e0d8f1cae7d
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
23790
diff
changeset
|
589 catch /E1105:/ |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
590 n = 266 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
591 endtry |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
592 assert_equal(266, n) |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
593 |
26372
f5727e2603f0
patch 8.2.3717: Vim9: error for constant list size is only given at runtime
Bram Moolenaar <Bram@vim.org>
parents:
26238
diff
changeset
|
594 l = [1, 2, 3] |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
595 try |
26372
f5727e2603f0
patch 8.2.3717: Vim9: error for constant list size is only given at runtime
Bram Moolenaar <Bram@vim.org>
parents:
26238
diff
changeset
|
596 [n] = l |
21365
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
597 catch /E1093:/ |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
598 n = 277 |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
599 endtry |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
600 assert_equal(277, n) |
fca850f4d603
patch 8.2.1233: Vim9: various errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21359
diff
changeset
|
601 |
21371
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
602 try |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
603 &ts = g:astring |
22284
6b385c2b9ff5
patch 8.2.1691: Vim9: list<any> is not accepted where list<number> is expected
Bram Moolenaar <Bram@vim.org>
parents:
22274
diff
changeset
|
604 catch /E1012:/ |
21371
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
605 n = 288 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
606 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
607 assert_equal(288, n) |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
608 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
609 try |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
610 &backspace = 'asdf' |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
611 catch /E474:/ |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
612 n = 299 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
613 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
614 assert_equal(299, n) |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
615 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
616 l = [1] |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
617 try |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
618 l[3] = 3 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
619 catch /E684:/ |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
620 n = 300 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
621 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
622 assert_equal(300, n) |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
623 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
624 try |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
625 unlet g:does_not_exist |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
626 catch /E108:/ |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
627 n = 322 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
628 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
629 assert_equal(322, n) |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
630 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
631 try |
22936
00b0275ffe7f
patch 8.2.2015: Vim9: literal dict #{} is not like any other language
Bram Moolenaar <Bram@vim.org>
parents:
22810
diff
changeset
|
632 d = {text: 1, [g:astring]: 2} |
21371
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
633 catch /E721:/ |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
634 n = 333 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
635 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
636 assert_equal(333, n) |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
637 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
638 try |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
639 l = g:DeletedFunc() |
21371
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
640 catch /E933:/ |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
641 n = 344 |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
642 endtry |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
643 assert_equal(344, n) |
21375
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
644 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
645 try |
25368
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25358
diff
changeset
|
646 echo range(1, 2, 0) |
1ffa8eb30353
patch 8.2.3221: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
25358
diff
changeset
|
647 catch /E726:/ |
21375
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
648 n = 355 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
649 endtry |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
650 assert_equal(355, n) |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
651 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
652 var P = function('g:NoSuchFunc') |
21375
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
653 delfunc g:NoSuchFunc |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
654 try |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
655 echo P() |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
656 catch /E117:/ |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
657 n = 366 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
658 endtry |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
659 assert_equal(366, n) |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
660 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
661 try |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
662 echo g:NoSuchFunc() |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
663 catch /E117:/ |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
664 n = 377 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
665 endtry |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
666 assert_equal(377, n) |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
667 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
668 try |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
669 echo g:alist + 4 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
670 catch /E745:/ |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
671 n = 388 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
672 endtry |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
673 assert_equal(388, n) |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
674 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
675 try |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
676 echo 4 + g:alist |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
677 catch /E745:/ |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
678 n = 399 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
679 endtry |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
680 assert_equal(399, n) |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
681 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
682 try |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
683 echo g:alist.member |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
684 catch /E715:/ |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
685 n = 400 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
686 endtry |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
687 assert_equal(400, n) |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
688 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
689 try |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
690 echo d.member |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
691 catch /E716:/ |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
692 n = 411 |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
693 endtry |
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
694 assert_equal(411, n) |
23921
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
695 |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
696 var counter = 0 |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
697 for i in range(4) |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
698 try |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
699 eval [][0] |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
700 catch |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
701 endtry |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
702 counter += 1 |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
703 endfor |
a834f9c082e3
patch 8.2.2503: Vim9: a caught error may leave something on the stack
Bram Moolenaar <Bram@vim.org>
parents:
23886
diff
changeset
|
704 assert_equal(4, counter) |
23994
3daeb2060f25
patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
23980
diff
changeset
|
705 |
25304
d39c12f97298
patch 8.2.3189: Vim9: error when using "try|"
Bram Moolenaar <Bram@vim.org>
parents:
25298
diff
changeset
|
706 # no requirement for spaces before | |
d39c12f97298
patch 8.2.3189: Vim9: error when using "try|"
Bram Moolenaar <Bram@vim.org>
parents:
25298
diff
changeset
|
707 try|echo 0|catch|endtry |
d39c12f97298
patch 8.2.3189: Vim9: error when using "try|"
Bram Moolenaar <Bram@vim.org>
parents:
25298
diff
changeset
|
708 |
26658
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
709 # return in try with finally |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
710 def ReturnInTry(): number |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
711 var ret = 4 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
712 try |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
713 return ret |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
714 catch /this/ |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
715 return -1 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
716 catch /that/ |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
717 return -1 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
718 finally |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
719 # changing ret has no effect |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
720 ret = 7 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
721 endtry |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
722 return -2 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
723 enddef |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
724 assert_equal(4, ReturnInTry()) |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
725 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
726 # return in catch with finally |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
727 def ReturnInCatch(): number |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
728 var ret = 5 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
729 try |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
730 throw 'getout' |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
731 return -1 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
732 catch /getout/ |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
733 # ret is evaluated here |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
734 return ret |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
735 finally |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
736 # changing ret later has no effect |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
737 ret = -3 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
738 endtry |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
739 return -2 |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
740 enddef |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
741 assert_equal(5, ReturnInCatch()) |
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
742 |
23994
3daeb2060f25
patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
23980
diff
changeset
|
743 # return in finally after empty catch |
3daeb2060f25
patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
23980
diff
changeset
|
744 def ReturnInFinally(): number |
3daeb2060f25
patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
23980
diff
changeset
|
745 try |
3daeb2060f25
patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
23980
diff
changeset
|
746 finally |
26658
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
747 return 6 |
23994
3daeb2060f25
patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
23980
diff
changeset
|
748 endtry |
3daeb2060f25
patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
23980
diff
changeset
|
749 enddef |
26658
ed73553992bf
patch 8.2.3858: Vim9: not enough tests
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
750 assert_equal(6, ReturnInFinally()) |
24934
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
751 |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
752 var lines =<< trim END |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
753 vim9script |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
754 try |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
755 acos('0.5') |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
756 ->setline(1) |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
757 catch |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
758 g:caught = v:exception |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
759 endtry |
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
760 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
761 v9.CheckScriptSuccess(lines) |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25368
diff
changeset
|
762 assert_match('E1219: Float or Number required for argument 1', g:caught) |
24934
75bd12f3bfeb
patch 8.2.3004: Vim9: error for missing colon given while skipping
Bram Moolenaar <Bram@vim.org>
parents:
24786
diff
changeset
|
763 unlet g:caught |
25124
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
764 |
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
765 # missing catch and/or finally |
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
766 lines =<< trim END |
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
767 vim9script |
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
768 try |
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
769 echo 'something' |
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
770 endtry |
075790758d11
patch 8.2.3099: Vim9: missing catch/finally not reported at script level
Bram Moolenaar <Bram@vim.org>
parents:
25082
diff
changeset
|
771 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
772 v9.CheckScriptFailure(lines, 'E1032:') |
25537
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
773 |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
774 # skipping try-finally-endtry when try-finally-endtry is used in another block |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
775 lines =<< trim END |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
776 if v:true |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
777 try |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
778 finally |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
779 endtry |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
780 else |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
781 try |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
782 finally |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
783 endtry |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
784 endif |
e0d6268c153a
patch 8.2.3305: Vim9: :finally in skipped block not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
25489
diff
changeset
|
785 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
786 v9.CheckDefAndScriptSuccess(lines) |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
787 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
788 |
27948
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
789 def Test_try_var_decl() |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
790 var lines =<< trim END |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
791 vim9script |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
792 try |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
793 var in_try = 1 |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
794 assert_equal(1, get(s:, 'in_try', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
795 throw "getout" |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
796 catch |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
797 var in_catch = 2 |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
798 assert_equal(-1, get(s:, 'in_try', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
799 assert_equal(2, get(s:, 'in_catch', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
800 finally |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
801 var in_finally = 3 |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
802 assert_equal(-1, get(s:, 'in_try', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
803 assert_equal(-1, get(s:, 'in_catch', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
804 assert_equal(3, get(s:, 'in_finally', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
805 endtry |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
806 assert_equal(-1, get(s:, 'in_try', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
807 assert_equal(-1, get(s:, 'in_catch', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
808 assert_equal(-1, get(s:, 'in_finally', -1)) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
809 END |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
810 v9.CheckScriptSuccess(lines) |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
811 enddef |
f57b8db06f26
patch 8.2.4499: Vim9: at the script level declarations leak to next block
Bram Moolenaar <Bram@vim.org>
parents:
27768
diff
changeset
|
812 |
27084
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
813 def Test_try_ends_in_return() |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
814 var lines =<< trim END |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
815 vim9script |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
816 def Foo(): string |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
817 try |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
818 return 'foo' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
819 catch |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
820 return 'caught' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
821 endtry |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
822 enddef |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
823 assert_equal('foo', Foo()) |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
824 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
825 v9.CheckScriptSuccess(lines) |
27084
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
826 |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
827 lines =<< trim END |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
828 vim9script |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
829 def Foo(): string |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
830 try |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
831 return 'foo' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
832 catch |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
833 return 'caught' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
834 endtry |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
835 echo 'notreached' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
836 enddef |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
837 assert_equal('foo', Foo()) |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
838 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
839 v9.CheckScriptFailure(lines, 'E1095:') |
27084
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
840 |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
841 lines =<< trim END |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
842 vim9script |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
843 def Foo(): string |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
844 try |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
845 return 'foo' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
846 catch /x/ |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
847 return 'caught' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
848 endtry |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
849 enddef |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
850 assert_equal('foo', Foo()) |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
851 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
852 v9.CheckScriptFailure(lines, 'E1027:') |
27084
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
853 |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
854 lines =<< trim END |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
855 vim9script |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
856 def Foo(): string |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
857 try |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
858 echo 'foo' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
859 catch |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
860 echo 'caught' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
861 finally |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
862 return 'done' |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
863 endtry |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
864 enddef |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
865 assert_equal('done', Foo()) |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
866 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
867 v9.CheckScriptSuccess(lines) |
27084
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
868 |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
869 enddef |
6fc63c6a7ee7
patch 8.2.4071: Vim9: no detection of return in try/endtry
Bram Moolenaar <Bram@vim.org>
parents:
27057
diff
changeset
|
870 |
25078
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
871 def Test_try_in_catch() |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
872 var lines =<< trim END |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
873 vim9script |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
874 var seq = [] |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
875 def DoIt() |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
876 try |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
877 seq->add('throw 1') |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
878 eval [][0] |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
879 seq->add('notreached') |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
880 catch |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
881 seq->add('catch') |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
882 try |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
883 seq->add('throw 2') |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
884 eval [][0] |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
885 seq->add('notreached') |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
886 catch /nothing/ |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
887 seq->add('notreached') |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
888 endtry |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
889 seq->add('done') |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
890 endtry |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
891 enddef |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
892 DoIt() |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
893 assert_equal(['throw 1', 'catch', 'throw 2', 'done'], seq) |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
894 END |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
895 enddef |
eac6e5a94e9d
patch 8.2.3076: Vim9: using try in catch block causes a hang
Bram Moolenaar <Bram@vim.org>
parents:
25057
diff
changeset
|
896 |
25080
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
897 def Test_error_in_catch() |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
898 var lines =<< trim END |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
899 try |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
900 eval [][0] |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
901 catch /E684:/ |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
902 eval [][0] |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
903 endtry |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
904 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
905 v9.CheckDefExecFailure(lines, 'E684:', 4) |
25080
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
906 enddef |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
907 |
24122
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
908 " :while at the very start of a function that :continue jumps to |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
909 def s:TryContinueFunc() |
24122
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
910 while g:Count < 2 |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
911 g:sequence ..= 't' |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
912 try |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
913 echoerr 'Test' |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
914 catch |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
915 g:Count += 1 |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
916 g:sequence ..= 'c' |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
917 continue |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
918 endtry |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
919 g:sequence ..= 'e' |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
920 g:Count += 1 |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
921 endwhile |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
922 enddef |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
923 |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
924 def Test_continue_in_try_in_while() |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
925 g:Count = 0 |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
926 g:sequence = '' |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
927 TryContinueFunc() |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
928 assert_equal('tctc', g:sequence) |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
929 unlet g:Count |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
930 unlet g:sequence |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
931 enddef |
e8b21a3bb0d5
patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Bram Moolenaar <Bram@vim.org>
parents:
24114
diff
changeset
|
932 |
28035
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
933 def Test_break_in_try_in_for() |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
934 var lines =<< trim END |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
935 vim9script |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
936 def Ls(): list<string> |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
937 var ls: list<string> |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
938 for s in ['abc', 'def'] |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
939 for _ in [123, 456] |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
940 try |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
941 eval [][0] |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
942 catch |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
943 break |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
944 endtry |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
945 endfor |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
946 ls += [s] |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
947 endfor |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
948 return ls |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
949 enddef |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
950 assert_equal(['abc', 'def'], Ls()) |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
951 END |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
952 v9.CheckScriptSuccess(lines) |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
953 enddef |
9f8535cf6f1b
patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Bram Moolenaar <Bram@vim.org>
parents:
27988
diff
changeset
|
954 |
24002
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
955 def Test_nocatch_return_in_try() |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
956 # return in try block returns normally |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
957 def ReturnInTry(): string |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
958 try |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
959 return '"some message"' |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
960 catch |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
961 endtry |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
962 return 'not reached' |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
963 enddef |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
964 exe 'echoerr ' .. ReturnInTry() |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
965 enddef |
5dbed4837ea3
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Bram Moolenaar <Bram@vim.org>
parents:
23994
diff
changeset
|
966 |
23656
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
967 def Test_cnext_works_in_catch() |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
968 var lines =<< trim END |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
969 vim9script |
25202
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
970 au BufEnter * eval 1 + 2 |
23656
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
971 writefile(['text'], 'Xfile1') |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
972 writefile(['text'], 'Xfile2') |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
973 var items = [ |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
974 {lnum: 1, filename: 'Xfile1', valid: true}, |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
975 {lnum: 1, filename: 'Xfile2', valid: true} |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
976 ] |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
977 setqflist([], ' ', {items: items}) |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
978 cwindow |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
979 |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
980 def CnextOrCfirst() |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
981 # if cnext fails, cfirst is used |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
982 try |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
983 cnext |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
984 catch |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
985 cfirst |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
986 endtry |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
987 enddef |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
988 |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
989 CnextOrCfirst() |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
990 CnextOrCfirst() |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
991 writefile([getqflist({idx: 0}).idx], 'Xresult') |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
992 qall |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
993 END |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
994 writefile(lines, 'XCatchCnext') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
995 g:RunVim([], [], '--clean -S XCatchCnext') |
23656
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
996 assert_equal(['1'], readfile('Xresult')) |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
997 |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
998 delete('Xfile1') |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
999 delete('Xfile2') |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
1000 delete('XCatchCnext') |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
1001 delete('Xresult') |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
1002 enddef |
c6f7df86cd9d
patch 8.2.2370: Vim9: command fails in catch block
Bram Moolenaar <Bram@vim.org>
parents:
23618
diff
changeset
|
1003 |
23576
4cd173b3d572
patch 8.2.2330: Vim9: crash when using :trow in a not executed block
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
1004 def Test_throw_skipped() |
4cd173b3d572
patch 8.2.2330: Vim9: crash when using :trow in a not executed block
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
1005 if 0 |
4cd173b3d572
patch 8.2.2330: Vim9: crash when using :trow in a not executed block
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
1006 throw dontgethere |
4cd173b3d572
patch 8.2.2330: Vim9: crash when using :trow in a not executed block
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
1007 endif |
4cd173b3d572
patch 8.2.2330: Vim9: crash when using :trow in a not executed block
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
1008 enddef |
4cd173b3d572
patch 8.2.2330: Vim9: crash when using :trow in a not executed block
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
1009 |
23618
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1010 def Test_nocatch_throw_silenced() |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1011 var lines =<< trim END |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1012 vim9script |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1013 def Func() |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1014 throw 'error' |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1015 enddef |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1016 silent! Func() |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1017 END |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1018 writefile(lines, 'XthrowSilenced') |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1019 source XthrowSilenced |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1020 delete('XthrowSilenced') |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1021 enddef |
d228ca435f3a
patch 8.2.2351: Vim9: error msg for "throw" in function called with "silent!"
Bram Moolenaar <Bram@vim.org>
parents:
23576
diff
changeset
|
1022 |
21371
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
1023 def DeletedFunc(): list<any> |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
1024 return ['delete me'] |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
1025 enddef |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
1026 defcompile |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
1027 delfunc DeletedFunc |
8e1081ede3b8
patch 8.2.1236: Vim9: a few errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21365
diff
changeset
|
1028 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1029 def s:ThrowFromDef() |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1030 throw "getout" # comment |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1031 enddef |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1032 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1033 func s:CatchInFunc() |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1034 try |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1035 call s:ThrowFromDef() |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1036 catch |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1037 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
|
1038 endtry |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1039 endfunc |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1040 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1041 def s:CatchInDef() |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1042 try |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1043 ThrowFromDef() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1044 catch |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1045 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
|
1046 endtry |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1047 enddef |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1048 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1049 def s:ReturnFinally(): string |
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
|
1050 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
|
1051 return 'intry' |
27970
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
1052 finally |
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
|
1053 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
|
1054 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
|
1055 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
|
1056 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
|
1057 |
19445
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1058 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
|
1059 CatchInFunc() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1060 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
|
1061 |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1062 CatchInDef() |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1063 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
|
1064 |
423b27246383
patch 8.2.0287: Vim9: return in try block not tested; catch not tested
Bram Moolenaar <Bram@vim.org>
parents:
19455
diff
changeset
|
1065 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
|
1066 assert_equal('finally', g:in_finally) |
25080
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1067 |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1068 var l = [] |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1069 try |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1070 l->add('1') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1071 throw 'bad' |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1072 l->add('x') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1073 catch /bad/ |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1074 l->add('2') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1075 try |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1076 l->add('3') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1077 throw 'one' |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1078 l->add('x') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1079 catch /one/ |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1080 l->add('4') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1081 try |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1082 l->add('5') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1083 throw 'more' |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1084 l->add('x') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1085 catch /more/ |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1086 l->add('6') |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1087 endtry |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1088 endtry |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1089 endtry |
146c9720e563
patch 8.2.3077: Vim9: an error in a catch block is not reported
Bram Moolenaar <Bram@vim.org>
parents:
25078
diff
changeset
|
1090 assert_equal(['1', '2', '3', '4', '5', '6'], l) |
25082
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1091 |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1092 l = [] |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1093 try |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1094 try |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1095 l->add('1') |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1096 throw 'foo' |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1097 l->add('x') |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1098 catch |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1099 l->add('2') |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1100 throw 'bar' |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1101 l->add('x') |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1102 finally |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1103 l->add('3') |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1104 endtry |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1105 l->add('x') |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1106 catch /bar/ |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1107 l->add('4') |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1108 endtry |
5c7a09cf97a1
patch 8.2.3078: Vim9: profile test fails
Bram Moolenaar <Bram@vim.org>
parents:
25080
diff
changeset
|
1109 assert_equal(['1', '2', '3', '4'], l) |
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
|
1110 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
|
1111 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1112 def s:TryOne(): number |
22302
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1113 try |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1114 return 0 |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1115 catch |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1116 endtry |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1117 return 0 |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1118 enddef |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1119 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1120 def s:TryTwo(n: number): string |
22302
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1121 try |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1122 var x = {} |
22302
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1123 catch |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1124 endtry |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1125 return 'text' |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1126 enddef |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1127 |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1128 def Test_try_catch_twice() |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1129 assert_equal('text', TryOne()->TryTwo()) |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1130 enddef |
36e8e046c335
patch 8.2.1700: Vim9: try/catch causes wrong value to be returned
Bram Moolenaar <Bram@vim.org>
parents:
22296
diff
changeset
|
1131 |
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
|
1132 def Test_try_catch_match() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1133 var seq = 'a' |
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
|
1134 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
|
1135 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
|
1136 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
|
1137 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
|
1138 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
|
1139 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
|
1140 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
|
1141 seq ..= 'x' |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1142 catch ?a\?sdf? |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1143 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
|
1144 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
|
1145 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
|
1146 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
|
1147 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
|
1148 enddef |
6e27e1ffa2a6
patch 8.2.0280: Vim9: throw in :def function not caught higher up
Bram Moolenaar <Bram@vim.org>
parents:
19443
diff
changeset
|
1149 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1150 def Test_try_catch_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1151 v9.CheckDefFailure(['catch'], 'E603:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1152 v9.CheckDefFailure(['try', 'echo 0', 'catch', 'catch'], 'E1033:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1153 v9.CheckDefFailure(['try', 'echo 0', 'catch /pat'], 'E1067:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1154 v9.CheckDefFailure(['finally'], 'E606:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1155 v9.CheckDefFailure(['try', 'echo 0', 'finally', 'echo 1', 'finally'], 'E607:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1156 v9.CheckDefFailure(['endtry'], 'E602:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1157 v9.CheckDefFailure(['while 1', 'endtry'], 'E170:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1158 v9.CheckDefFailure(['for i in range(5)', 'endtry'], 'E170:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1159 v9.CheckDefFailure(['if 1', 'endtry'], 'E171:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1160 v9.CheckDefFailure(['try', 'echo 1', 'endtry'], 'E1032:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1161 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1162 v9.CheckDefFailure(['throw'], 'E1143:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1163 v9.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
|
1164 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1165 |
23950
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1166 def Try_catch_skipped() |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1167 var l = [] |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1168 try |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1169 finally |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1170 endtry |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1171 |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1172 if 1 |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1173 else |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1174 try |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1175 endtry |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1176 endif |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1177 enddef |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1178 |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1179 " The skipped try/endtry was updating the wrong instruction. |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1180 def Test_try_catch_skipped() |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1181 var instr = execute('disassemble Try_catch_skipped') |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1182 assert_match("NEWLIST size 0\n", instr) |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1183 enddef |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1184 |
27665
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1185 def Test_throw_line_number() |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1186 def Func() |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1187 eval 1 + 1 |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1188 eval 2 + 2 |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1189 throw 'exception' |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1190 enddef |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1191 try |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1192 Func() |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1193 catch /exception/ |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1194 assert_match('line 3', v:throwpoint) |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1195 endtry |
a6ffe874a24b
patch 8.2.4358: Vim9: line number of exception is not set
Bram Moolenaar <Bram@vim.org>
parents:
27575
diff
changeset
|
1196 enddef |
23950
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1197 |
4279c1c66df1
patch 8.2.2517: Vim9: fix for s390 not tested on other systems
Bram Moolenaar <Bram@vim.org>
parents:
23940
diff
changeset
|
1198 |
21094
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1199 def Test_throw_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1200 # only checks line continuation |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1201 var lines =<< trim END |
21094
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1202 vim9script |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1203 try |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1204 throw 'one' |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1205 .. 'two' |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1206 catch |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1207 assert_equal('onetwo', v:exception) |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1208 endtry |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1209 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1210 v9.CheckScriptSuccess(lines) |
22612
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1211 |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1212 lines =<< trim END |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1213 vim9script |
22621
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
1214 @r = '' |
22612
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1215 def Func() |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1216 throw @r |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1217 enddef |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1218 var result = '' |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1219 try |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1220 Func() |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1221 catch /E1129:/ |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1222 result = 'caught' |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1223 endtry |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1224 assert_equal('caught', result) |
b08f435d5b86
patch 8.2.1854: Vim9: crash when throwing exception for NULL string
Bram Moolenaar <Bram@vim.org>
parents:
22602
diff
changeset
|
1225 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1226 v9.CheckScriptSuccess(lines) |
21094
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1227 enddef |
376b520312d6
patch 8.2.1098: Vim9: cannot use line break in :throw argument
Bram Moolenaar <Bram@vim.org>
parents:
20982
diff
changeset
|
1228 |
21757
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1229 def Test_error_in_nested_function() |
23940
949238ccbd50
patch 8.2.2512: Vim9: compiling error test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
23927
diff
changeset
|
1230 # an error in a nested :function aborts executing in the calling :def function |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1231 var lines =<< trim END |
21757
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1232 vim9script |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1233 def Func() |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1234 Error() |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1235 g:test_var = 1 |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1236 enddef |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1237 func Error() abort |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1238 eval [][0] |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1239 endfunc |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1240 Func() |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1241 END |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1242 g:test_var = 0 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1243 v9.CheckScriptFailure(lines, 'E684:') |
21757
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1244 assert_equal(0, g:test_var) |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1245 enddef |
6c03897bcd60
patch 8.2.1428: Vim9: :def function does not abort on nested function error
Bram Moolenaar <Bram@vim.org>
parents:
21709
diff
changeset
|
1246 |
24555
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1247 def Test_abort_after_error() |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1248 var lines =<< trim END |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1249 vim9script |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1250 while true |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1251 echo notfound |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1252 endwhile |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1253 g:gotthere = true |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1254 END |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1255 g:gotthere = false |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1256 v9.CheckScriptFailure(lines, 'E121:') |
24555
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1257 assert_false(g:gotthere) |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1258 unlet g:gotthere |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1259 enddef |
83877a1b66fd
patch 8.2.2817: Vim9: script sourcing continues after an error
Bram Moolenaar <Bram@vim.org>
parents:
24471
diff
changeset
|
1260 |
21096
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1261 def Test_cexpr_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1262 # only checks line continuation |
21096
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1263 set errorformat=File\ %f\ line\ %l |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1264 var lines =<< trim END |
21096
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1265 vim9script |
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1266 cexpr 'File' |
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1267 .. ' someFile' .. |
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1268 ' line 19' |
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1269 assert_equal(19, getqflist()[0].lnum) |
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1270 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1271 v9.CheckScriptSuccess(lines) |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1272 |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1273 lines =<< trim END |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1274 vim9script |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1275 def CexprFail() |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1276 au QuickfixCmdPre * echo g:doesnotexist |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1277 cexpr 'File otherFile line 99' |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1278 g:didContinue = 'yes' |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1279 enddef |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1280 CexprFail() |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1281 g:didContinue = 'also' |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1282 END |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1283 g:didContinue = 'no' |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1284 v9.CheckScriptFailure(lines, 'E121: Undefined variable: g:doesnotexist') |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1285 assert_equal('no', g:didContinue) |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1286 au! QuickfixCmdPre |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1287 |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1288 lines =<< trim END |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1289 vim9script |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1290 def CexprFail() |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1291 cexpr g:aNumber |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1292 g:didContinue = 'yes' |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1293 enddef |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1294 CexprFail() |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1295 g:didContinue = 'also' |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1296 END |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1297 g:aNumber = 123 |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1298 g:didContinue = 'no' |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1299 v9.CheckScriptFailure(lines, 'E777: String or List expected') |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1300 assert_equal('no', g:didContinue) |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1301 unlet g:didContinue |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1302 |
21096
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1303 set errorformat& |
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1304 enddef |
74e5e212e550
patch 8.2.1099: Vim9: cannot use line break in :cexpr argument
Bram Moolenaar <Bram@vim.org>
parents:
21094
diff
changeset
|
1305 |
21775
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1306 def Test_statusline_syntax() |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1307 # legacy syntax is used for 'statusline' |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1308 var lines =<< trim END |
21775
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1309 vim9script |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1310 func g:Status() |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1311 return '%{"x" is# "x"}' |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1312 endfunc |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1313 set laststatus=2 statusline=%!Status() |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1314 redrawstatus |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1315 set laststatus statusline= |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1316 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1317 v9.CheckScriptSuccess(lines) |
21775
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1318 enddef |
6922d78b4d52
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Bram Moolenaar <Bram@vim.org>
parents:
21757
diff
changeset
|
1319 |
21391
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1320 def Test_list_vimscript() |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1321 # checks line continuation and comments |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1322 var lines =<< trim END |
21391
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1323 vim9script |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1324 var mylist = [ |
21391
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1325 'one', |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1326 # comment |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1327 'two', # empty line follows |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1328 |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1329 'three', |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1330 ] |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1331 assert_equal(['one', 'two', 'three'], mylist) |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1332 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1333 v9.CheckScriptSuccess(lines) |
21883
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1334 |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1335 # check all lines from heredoc are kept |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1336 lines =<< trim END |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1337 # comment 1 |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1338 two |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1339 # comment 3 |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1340 |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1341 five |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1342 # comment 6 |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1343 END |
a427f5f26419
patch 8.2.1491: Vim9: crash when compiling heredoc lines start with comment
Bram Moolenaar <Bram@vim.org>
parents:
21881
diff
changeset
|
1344 assert_equal(['# comment 1', 'two', '# comment 3', '', 'five', '# comment 6'], lines) |
23703
6bfb302d8392
patch 8.2.2393: Vim9: error message when script line starts with "[{"
Bram Moolenaar <Bram@vim.org>
parents:
23658
diff
changeset
|
1345 |
6bfb302d8392
patch 8.2.2393: Vim9: error message when script line starts with "[{"
Bram Moolenaar <Bram@vim.org>
parents:
23658
diff
changeset
|
1346 lines =<< trim END |
6bfb302d8392
patch 8.2.2393: Vim9: error message when script line starts with "[{"
Bram Moolenaar <Bram@vim.org>
parents:
23658
diff
changeset
|
1347 [{ |
6bfb302d8392
patch 8.2.2393: Vim9: error message when script line starts with "[{"
Bram Moolenaar <Bram@vim.org>
parents:
23658
diff
changeset
|
1348 a: 0}]->string()->assert_equal("[{'a': 0}]") |
6bfb302d8392
patch 8.2.2393: Vim9: error message when script line starts with "[{"
Bram Moolenaar <Bram@vim.org>
parents:
23658
diff
changeset
|
1349 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1350 v9.CheckDefAndScriptSuccess(lines) |
21391
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1351 enddef |
8b882afa8ed2
patch 8.2.1246: Vim9: comment after assignment doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
21375
diff
changeset
|
1352 |
20291
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1353 if has('channel') |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1354 let someJob = test_null_job() |
20289
208b38bddc36
patch 8.2.0700: Vim9: converting error message to exception not tested
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
1355 |
20291
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1356 def FuncWithError() |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1357 echomsg g:someJob |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1358 enddef |
20289
208b38bddc36
patch 8.2.0700: Vim9: converting error message to exception not tested
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
1359 |
20291
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1360 func Test_convert_emsg_to_exception() |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1361 try |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1362 call FuncWithError() |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1363 catch |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1364 call assert_match('Vim:E908:', v:exception) |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1365 endtry |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1366 endfunc |
f7b1e43beb8f
patch 8.2.0701: Vim9 test fails without job feature
Bram Moolenaar <Bram@vim.org>
parents:
20289
diff
changeset
|
1367 endif |
20289
208b38bddc36
patch 8.2.0700: Vim9: converting error message to exception not tested
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
1368 |
23974
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1369 def Test_vim9script_mix() |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1370 var lines =<< trim END |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1371 if has(g:feature) |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1372 " legacy script |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1373 let g:legacy = 1 |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1374 finish |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1375 endif |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1376 vim9script |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1377 g:legacy = 0 |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1378 END |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1379 g:feature = 'eval' |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1380 g:legacy = -1 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1381 v9.CheckScriptSuccess(lines) |
23974
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1382 assert_equal(1, g:legacy) |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1383 |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1384 g:feature = 'noteval' |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1385 g:legacy = -1 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1386 v9.CheckScriptSuccess(lines) |
23974
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1387 assert_equal(0, g:legacy) |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1388 enddef |
d4f7e4138544
patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Bram Moolenaar <Bram@vim.org>
parents:
23954
diff
changeset
|
1389 |
19507
65049a682574
patch 8.2.0311: Vim9: insufficient script tests
Bram Moolenaar <Bram@vim.org>
parents:
19497
diff
changeset
|
1390 def Test_vim9script_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1391 v9.CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1392 v9.CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1393 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1394 v9.CheckScriptFailure(['vim9script', 'var str: string', 'str = 1234'], 'E1012:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1395 v9.CheckScriptFailure(['vim9script', 'const str = "asdf"', 'str = "xxx"'], 'E46:') |
20919
96bf2b304932
patch 8.2.1011: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
20915
diff
changeset
|
1396 |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21987
diff
changeset
|
1397 assert_fails('vim9script', 'E1038:') |
27571
55f0ac079829
patch 8.2.4312: no error for using :vim9script in a :def function
Bram Moolenaar <Bram@vim.org>
parents:
27541
diff
changeset
|
1398 v9.CheckDefFailure(['vim9script'], 'E1038:') |
27575
9f70df0b2967
patch 8.2.4314: test fails where lines are skipped
Bram Moolenaar <Bram@vim.org>
parents:
27571
diff
changeset
|
1399 |
9f70df0b2967
patch 8.2.4314: test fails where lines are skipped
Bram Moolenaar <Bram@vim.org>
parents:
27571
diff
changeset
|
1400 # no error when skipping |
9f70df0b2967
patch 8.2.4314: test fails where lines are skipped
Bram Moolenaar <Bram@vim.org>
parents:
27571
diff
changeset
|
1401 if has('nothing') |
9f70df0b2967
patch 8.2.4314: test fails where lines are skipped
Bram Moolenaar <Bram@vim.org>
parents:
27571
diff
changeset
|
1402 vim9script |
9f70df0b2967
patch 8.2.4314: test fails where lines are skipped
Bram Moolenaar <Bram@vim.org>
parents:
27571
diff
changeset
|
1403 endif |
24146
03fc95628eb0
patch 8.2.2614: Vim9: function is deleted while executing
Bram Moolenaar <Bram@vim.org>
parents:
24122
diff
changeset
|
1404 enddef |
03fc95628eb0
patch 8.2.2614: Vim9: function is deleted while executing
Bram Moolenaar <Bram@vim.org>
parents:
24122
diff
changeset
|
1405 |
24051
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1406 def Test_script_var_shadows_function() |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1407 var lines =<< trim END |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1408 vim9script |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1409 def Func(): number |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1410 return 123 |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1411 enddef |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1412 var Func = 1 |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1413 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1414 v9.CheckScriptFailure(lines, 'E1041:', 5) |
24051
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1415 enddef |
da8347e453b4
patch 8.2.2567: Vim9: no error if variable is defined for existing function
Bram Moolenaar <Bram@vim.org>
parents:
24033
diff
changeset
|
1416 |
26504
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1417 def Test_function_shadows_script_var() |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1418 var lines =<< trim END |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1419 vim9script |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1420 var Func = 1 |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1421 def Func(): number |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1422 return 123 |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1423 enddef |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1424 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1425 v9.CheckScriptFailure(lines, 'E1041:', 3) |
26504
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1426 enddef |
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1427 |
25202
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1428 def Test_script_var_shadows_command() |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1429 var lines =<< trim END |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1430 var undo = 1 |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1431 undo = 2 |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1432 assert_equal(2, undo) |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1433 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1434 v9.CheckDefAndScriptSuccess(lines) |
25202
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1435 |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1436 lines =<< trim END |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1437 var undo = 1 |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1438 undo |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1439 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1440 v9.CheckDefAndScriptFailure(lines, 'E1207:', 2) |
25202
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1441 enddef |
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1442 |
26506
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1443 def Test_vim9script_call_wrong_type() |
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1444 var lines =<< trim END |
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1445 vim9script |
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1446 var Time = 'localtime' |
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1447 Time() |
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1448 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1449 v9.CheckScriptFailure(lines, 'E1085:') |
26506
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1450 enddef |
4a1d2abc2016
patch 8.2.3783: confusing error for using a variable as a function
Bram Moolenaar <Bram@vim.org>
parents:
26504
diff
changeset
|
1451 |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1452 def Test_vim9script_reload_delfunc() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1453 var first_lines =<< trim END |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1454 vim9script |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1455 def FuncYes(): string |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1456 return 'yes' |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1457 enddef |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1458 END |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1459 var withno_lines =<< trim END |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1460 def FuncNo(): string |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1461 return 'no' |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1462 enddef |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1463 def g:DoCheck(no_exists: bool) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1464 assert_equal('yes', FuncYes()) |
20195
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1465 assert_equal('no', FuncNo()) |
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1466 enddef |
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1467 END |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1468 var nono_lines =<< trim END |
20195
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1469 def g:DoCheck(no_exists: bool) |
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1470 assert_equal('yes', FuncYes()) |
22165
c512e6f57ff2
patch 8.2.1632: not checking the context of test_fails()
Bram Moolenaar <Bram@vim.org>
parents:
22147
diff
changeset
|
1471 assert_fails('FuncNo()', 'E117:', '', 2, 'DoCheck') |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1472 enddef |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1473 END |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1474 |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1475 # FuncNo() is defined |
20195
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1476 writefile(first_lines + withno_lines, 'Xreloaded.vim') |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1477 source Xreloaded.vim |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1478 g:DoCheck(true) |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1479 |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1480 # FuncNo() is not redefined |
20195
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1481 writefile(first_lines + nono_lines, 'Xreloaded.vim') |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1482 source Xreloaded.vim |
23252
35583da6397e
patch 8.2.2172: Vim9: number of arguments is not always checked
Bram Moolenaar <Bram@vim.org>
parents:
23247
diff
changeset
|
1483 g:DoCheck(false) |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1484 |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1485 # FuncNo() is back |
20195
a2447c58da25
patch 8.2.0653: using uninitialized pointer
Bram Moolenaar <Bram@vim.org>
parents:
20189
diff
changeset
|
1486 writefile(first_lines + withno_lines, 'Xreloaded.vim') |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1487 source Xreloaded.vim |
23252
35583da6397e
patch 8.2.2172: Vim9: number of arguments is not always checked
Bram Moolenaar <Bram@vim.org>
parents:
23247
diff
changeset
|
1488 g:DoCheck(false) |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1489 |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1490 delete('Xreloaded.vim') |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1491 enddef |
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
1492 |
20347
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1493 def Test_vim9script_reload_delvar() |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1494 # write the script with a script-local variable |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1495 var lines =<< trim END |
20347
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1496 vim9script |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1497 var name = 'string' |
20347
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1498 END |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1499 writefile(lines, 'XreloadVar.vim') |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1500 source XreloadVar.vim |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1501 |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1502 # now write the script using the same variable locally - works |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1503 lines =<< trim END |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1504 vim9script |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1505 def Func() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1506 var name = 'string' |
20347
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1507 enddef |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1508 END |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1509 writefile(lines, 'XreloadVar.vim') |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1510 source XreloadVar.vim |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1511 |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1512 delete('XreloadVar.vim') |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1513 enddef |
0e1dfff4f294
patch 8.2.0729: Vim9: When reloading a script variables are not cleared
Bram Moolenaar <Bram@vim.org>
parents:
20338
diff
changeset
|
1514 |
21791
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1515 def Test_func_redefine_error() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1516 var lines = [ |
21791
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1517 'vim9script', |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1518 'def Func()', |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1519 ' eval [][0]', |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1520 'enddef', |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1521 'Func()', |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1522 ] |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1523 writefile(lines, 'Xtestscript.vim') |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1524 |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1525 for count in range(3) |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1526 try |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1527 source Xtestscript.vim |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1528 catch /E684/ |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1529 # function name should contain <SNR> every time |
28735
c428a4e53b9c
patch 8.2.4892: test failures because of changed error messages
Bram Moolenaar <Bram@vim.org>
parents:
28721
diff
changeset
|
1530 assert_match('E684: List index out of range', v:exception) |
21791
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1531 assert_match('function <SNR>\d\+_Func, line 1', v:throwpoint) |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1532 endtry |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1533 endfor |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1534 |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1535 delete('Xtestscript.vim') |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1536 enddef |
d504fcd3d2c0
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Bram Moolenaar <Bram@vim.org>
parents:
21775
diff
changeset
|
1537 |
21600
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1538 def Test_func_redefine_fails() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1539 var lines =<< trim END |
21600
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1540 vim9script |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1541 def Func() |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1542 echo 'one' |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1543 enddef |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1544 def Func() |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1545 echo 'two' |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1546 enddef |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1547 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1548 v9.CheckScriptFailure(lines, 'E1073:') |
21683
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1549 |
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1550 lines =<< trim END |
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1551 vim9script |
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1552 def Foo(): string |
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1553 return 'foo' |
26504
7821550ba3a8
patch 8.2.3782: Vim9: no error if a function shadows a script variable
Bram Moolenaar <Bram@vim.org>
parents:
26496
diff
changeset
|
1554 enddef |
21683
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1555 def Func() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1556 var Foo = {-> 'lambda'} |
21683
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1557 enddef |
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1558 defcompile |
bb4f55d20951
patch 8.2.1391: Vim9: no error for shadowing a script function
Bram Moolenaar <Bram@vim.org>
parents:
21681
diff
changeset
|
1559 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1560 v9.CheckScriptFailure(lines, 'E1073:') |
21600
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1561 enddef |
622021f43db1
patch 8.2.1350: Vim9: no test for error message when redefining function
Bram Moolenaar <Bram@vim.org>
parents:
21598
diff
changeset
|
1562 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1563 def Test_fixed_size_list() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1564 # will be allocated as one piece of memory, check that changes work |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1565 var l = [1, 2, 3, 4] |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1566 l->remove(0) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1567 l->add(5) |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1568 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
|
1569 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
|
1570 enddef |
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1571 |
21516
c7b2ce90c2de
patch 8.2.1308: Vim9: accidentally using "x" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
21485
diff
changeset
|
1572 def Test_no_insert_xit() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1573 v9.CheckDefExecFailure(['a = 1'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1574 v9.CheckDefExecFailure(['c = 1'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1575 v9.CheckDefExecFailure(['i = 1'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1576 v9.CheckDefExecFailure(['t = 1'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1577 v9.CheckDefExecFailure(['x = 1'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1578 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1579 v9.CheckScriptFailure(['vim9script', 'a = 1'], 'E488:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1580 v9.CheckScriptFailure(['vim9script', 'a'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1581 v9.CheckScriptFailure(['vim9script', 'c = 1'], 'E488:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1582 v9.CheckScriptFailure(['vim9script', 'c'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1583 v9.CheckScriptFailure(['vim9script', 'i = 1'], 'E488:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1584 v9.CheckScriptFailure(['vim9script', 'i'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1585 v9.CheckScriptFailure(['vim9script', 'o = 1'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1586 v9.CheckScriptFailure(['vim9script', 'o'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1587 v9.CheckScriptFailure(['vim9script', 't'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1588 v9.CheckScriptFailure(['vim9script', 't = 1'], 'E1100:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1589 v9.CheckScriptFailure(['vim9script', 'x = 1'], 'E1100:') |
21516
c7b2ce90c2de
patch 8.2.1308: Vim9: accidentally using "x" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
21485
diff
changeset
|
1590 enddef |
c7b2ce90c2de
patch 8.2.1308: Vim9: accidentally using "x" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
21485
diff
changeset
|
1591 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1592 def s:IfElse(what: number): string |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1593 var res = '' |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1594 if what == 1 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1595 res = "one" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1596 elseif what == 2 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1597 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
|
1598 else |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1599 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
|
1600 endif |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1601 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
|
1602 enddef |
a8d2d3c8f0b3
patch 8.2.0185: Vim9 script: cannot use "if has()" to skip lines
Bram Moolenaar <Bram@vim.org>
parents:
19185
diff
changeset
|
1603 |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1604 def Test_if_elseif_else() |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1605 assert_equal('one', IfElse(1)) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1606 assert_equal('two', IfElse(2)) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
1607 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
|
1608 enddef |
9fcdeaa18bd1
patch 8.2.0199: Vim9 script commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19253
diff
changeset
|
1609 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1610 def Test_if_elseif_else_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1611 v9.CheckDefFailure(['elseif true'], 'E582:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1612 v9.CheckDefFailure(['else'], 'E581:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1613 v9.CheckDefFailure(['endif'], 'E580:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1614 v9.CheckDefFailure(['if g:abool', 'elseif xxx'], 'E1001:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1615 v9.CheckDefFailure(['if true', 'echo 1'], 'E171:') |
23882
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1616 |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1617 var lines =<< trim END |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1618 var s = '' |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1619 if s = '' |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1620 endif |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1621 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1622 v9.CheckDefFailure(lines, 'E488:') |
23882
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1623 |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1624 lines =<< trim END |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1625 var s = '' |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1626 if s == '' |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1627 elseif s = '' |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1628 endif |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
1629 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1630 v9.CheckDefFailure(lines, 'E488:') |
28299
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1631 |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1632 lines =<< trim END |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1633 var cond = true |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1634 if cond |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1635 echo 'true' |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1636 elseif |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1637 echo 'false' |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1638 endif |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1639 END |
fae7d94220e3
patch 8.2.4675: no error for missing expression after :elseif
Bram Moolenaar <Bram@vim.org>
parents:
28281
diff
changeset
|
1640 v9.CheckDefAndScriptFailure(lines, ['E1143:', 'E15:'], 4) |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1641 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1642 |
28698
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1643 def Test_if_else_func_using_var() |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1644 var lines =<< trim END |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1645 vim9script |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1646 |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1647 const debug = true |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1648 if debug |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1649 var mode_chars = 'something' |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1650 def Bits2Ascii() |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1651 var x = mode_chars |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1652 g:where = 'in true' |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1653 enddef |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1654 else |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1655 def Bits2Ascii() |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1656 g:where = 'in false' |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1657 enddef |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1658 endif |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1659 |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1660 Bits2Ascii() |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1661 END |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1662 v9.CheckScriptSuccess(lines) |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1663 assert_equal('in true', g:where) |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1664 unlet g:where |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1665 |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1666 lines =<< trim END |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1667 vim9script |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1668 |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1669 const debug = false |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1670 if debug |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1671 var mode_chars = 'something' |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1672 def Bits2Ascii() |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1673 g:where = 'in true' |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1674 enddef |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1675 else |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1676 def Bits2Ascii() |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1677 var x = mode_chars |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1678 g:where = 'in false' |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1679 enddef |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1680 endif |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1681 |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1682 Bits2Ascii() |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1683 END |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1684 v9.CheckScriptFailure(lines, 'E1001: Variable not found: mode_chars') |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1685 enddef |
096a5f9a03a8
patch 8.2.4873: Vim9: using "else" differs from using "endif/if !cond"
Bram Moolenaar <Bram@vim.org>
parents:
28694
diff
changeset
|
1686 |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1687 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
|
1688 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
|
1689 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1690 def Test_if_const_expr() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1691 var res = false |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1692 if true ? true : false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1693 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1694 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1695 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1696 |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1697 g:glob = 2 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1698 if false |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
1699 execute('g:glob = 3') |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1700 endif |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1701 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
|
1702 if true |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
1703 execute('g:glob = 3') |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1704 endif |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1705 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
|
1706 |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1707 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1708 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
|
1709 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1710 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1711 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1712 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1713 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1714 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
|
1715 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1716 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1717 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1718 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1719 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1720 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
|
1721 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1722 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1723 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1724 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1725 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1726 if true ? false : true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1727 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1728 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1729 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1730 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1731 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1732 if false ? false : true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1733 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1734 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1735 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1736 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1737 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1738 if false ? true : false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1739 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1740 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1741 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1742 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1743 res = false |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1744 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
|
1745 res = true |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1746 endif |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1747 assert_equal(false, res) |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1748 |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
1749 res = false |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1750 if true && true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1751 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1752 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1753 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1754 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1755 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1756 if true && false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1757 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1758 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1759 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1760 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1761 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1762 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
|
1763 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1764 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1765 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1766 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1767 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1768 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
|
1769 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1770 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1771 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1772 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1773 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1774 if false && false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1775 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1776 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1777 assert_equal(false, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1778 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1779 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1780 if true || false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1781 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1782 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1783 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1784 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1785 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1786 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
|
1787 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1788 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1789 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1790 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1791 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1792 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
|
1793 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1794 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1795 assert_equal(true, res) |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1796 |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1797 res = false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1798 if false || false |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1799 res = true |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1800 endif |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1801 assert_equal(false, res) |
21957
4343657b49fa
patch 8.2.1528: Vim9: :endif not found after "if false"
Bram Moolenaar <Bram@vim.org>
parents:
21955
diff
changeset
|
1802 |
4343657b49fa
patch 8.2.1528: Vim9: :endif not found after "if false"
Bram Moolenaar <Bram@vim.org>
parents:
21955
diff
changeset
|
1803 # with constant "false" expression may be invalid so long as the syntax is OK |
25202
e5d85e83a887
patch 8.2.3137: Vim9: no error when a line only has a variable name
Bram Moolenaar <Bram@vim.org>
parents:
25188
diff
changeset
|
1804 if false | eval 1 + 2 | endif |
21957
4343657b49fa
patch 8.2.1528: Vim9: :endif not found after "if false"
Bram Moolenaar <Bram@vim.org>
parents:
21955
diff
changeset
|
1805 if false | eval burp + 234 | endif |
4343657b49fa
patch 8.2.1528: Vim9: :endif not found after "if false"
Bram Moolenaar <Bram@vim.org>
parents:
21955
diff
changeset
|
1806 if false | echo burp 234 'asd' | endif |
4343657b49fa
patch 8.2.1528: Vim9: :endif not found after "if false"
Bram Moolenaar <Bram@vim.org>
parents:
21955
diff
changeset
|
1807 if false |
4343657b49fa
patch 8.2.1528: Vim9: :endif not found after "if false"
Bram Moolenaar <Bram@vim.org>
parents:
21955
diff
changeset
|
1808 burp |
4343657b49fa
patch 8.2.1528: Vim9: :endif not found after "if false"
Bram Moolenaar <Bram@vim.org>
parents:
21955
diff
changeset
|
1809 endif |
25551
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1810 |
27541
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1811 if 0 |
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1812 if 1 |
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1813 echo nothing |
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1814 elseif 1 |
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1815 echo still nothing |
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1816 endif |
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1817 endif |
8af6e7761b0c
patch 8.2.4297: Vim9: not all code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27515
diff
changeset
|
1818 |
25551
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1819 # expression with line breaks skipped |
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1820 if false |
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1821 ('aaa' |
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1822 .. 'bbb' |
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1823 .. 'ccc' |
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1824 )->setline(1) |
5ab75ca75d21
patch 8.2.3312: Vim9: after "if false" line breaks in expression not skipped
Bram Moolenaar <Bram@vim.org>
parents:
25541
diff
changeset
|
1825 endif |
19878
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
1826 enddef |
19585
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1827 |
19878
dd3c80122a0e
patch 8.2.0495: Vim9: some code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19874
diff
changeset
|
1828 def Test_if_const_expr_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1829 v9.CheckDefFailure(['if "aaa" == "bbb'], 'E114:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1830 v9.CheckDefFailure(["if 'aaa' == 'bbb"], 'E115:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1831 v9.CheckDefFailure(["if has('aaa'"], 'E110:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1832 v9.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
|
1833 enddef |
0303f920a7d4
patch 8.2.0349: Vim9: constant expression not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19583
diff
changeset
|
1834 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1835 def s:RunNested(i: number): number |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1836 var x: number = 0 |
20899
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1837 if i % 2 |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1838 if 1 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1839 # comment |
20899
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1840 else |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1841 # comment |
20899
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1842 endif |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1843 x += 1 |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1844 else |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1845 x += 1000 |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1846 endif |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1847 return x |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1848 enddef |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1849 |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1850 def Test_nested_if() |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1851 assert_equal(1, RunNested(1)) |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1852 assert_equal(1000, RunNested(2)) |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1853 enddef |
e76bddcf3341
patch 8.2.1001: Vim9: crash with nested "if" and assignment
Bram Moolenaar <Bram@vim.org>
parents:
20885
diff
changeset
|
1854 |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1855 def Test_execute_cmd() |
23183
4d5d12138b36
patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents:
23179
diff
changeset
|
1856 # missing argument is ignored |
4d5d12138b36
patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents:
23179
diff
changeset
|
1857 execute |
4d5d12138b36
patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents:
23179
diff
changeset
|
1858 execute # comment |
4d5d12138b36
patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents:
23179
diff
changeset
|
1859 |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1860 new |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1861 setline(1, 'default') |
22147
d55008685870
patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
1862 execute 'setline(1, "execute-string")' |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1863 assert_equal('execute-string', getline(1)) |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1864 |
22147
d55008685870
patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
1865 execute "setline(1, 'execute-string')" |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1866 assert_equal('execute-string', getline(1)) |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1867 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1868 var cmd1 = 'setline(1,' |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1869 var cmd2 = '"execute-var")' |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1870 execute cmd1 cmd2 # comment |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1871 assert_equal('execute-var', getline(1)) |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1872 |
22147
d55008685870
patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
1873 execute cmd1 cmd2 '|setline(1, "execute-var-string")' |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1874 assert_equal('execute-var-string', getline(1)) |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1875 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1876 var cmd_first = 'call ' |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1877 var cmd_last = 'setline(1, "execute-var-var")' |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1878 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
|
1879 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
|
1880 bwipe! |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1881 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1882 var n = true |
21485
afc8cc1a291f
patch 8.2.1293: Vim9: error when using vim9script in TextYankPost
Bram Moolenaar <Bram@vim.org>
parents:
21479
diff
changeset
|
1883 execute 'echomsg' (n ? '"true"' : '"no"') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1884 assert_match('^true$', g:Screenline(&lines)) |
21485
afc8cc1a291f
patch 8.2.1293: Vim9: error when using vim9script in TextYankPost
Bram Moolenaar <Bram@vim.org>
parents:
21479
diff
changeset
|
1885 |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
1886 echomsg [1, 2, 3] {a: 1, b: 2} |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1887 assert_match('^\[1, 2, 3\] {''a'': 1, ''b'': 2}$', g:Screenline(&lines)) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1888 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1889 v9.CheckDefFailure(['execute xxx'], 'E1001:', 1) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1890 v9.CheckDefExecFailure(['execute "tabnext " .. 8'], 'E475:', 1) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1891 v9.CheckDefFailure(['execute "cmd"# comment'], 'E488:', 1) |
27768
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
1892 if has('channel') |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
1893 v9.CheckDefExecFailure(['execute test_null_channel()'], 'E908:', 1) |
b081ba78675a
patch 8.2.4410: Vim9: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
27690
diff
changeset
|
1894 endif |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1895 enddef |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1896 |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1897 def Test_execute_cmd_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1898 # only checks line continuation |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1899 var lines =<< trim END |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1900 vim9script |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1901 execute 'g:someVar' |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1902 .. ' = ' .. |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1903 '28' |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1904 assert_equal(28, g:someVar) |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1905 unlet g:someVar |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1906 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1907 v9.CheckScriptSuccess(lines) |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1908 enddef |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1909 |
28193
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1910 def Test_execute_finish() |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1911 # the empty lines are relevant here |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1912 var lines =<< trim END |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1913 vim9script |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1914 |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1915 var vname = "g:hello" |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1916 |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1917 if exists(vname) | finish | endif | execute vname '= "world"' |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1918 |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1919 assert_equal('world', g:hello) |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1920 |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1921 if exists(vname) | finish | endif | execute vname '= "world"' |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1922 |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1923 assert_report('should not be reached') |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1924 END |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1925 v9.CheckScriptSuccess(lines) |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1926 enddef |
22c8cafe8c9c
patch 8.2.4622: Vim9: crash with :execute and :finish
Bram Moolenaar <Bram@vim.org>
parents:
28156
diff
changeset
|
1927 |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1928 def Test_echo_cmd() |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1929 echo 'some' # comment |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
1930 echon 'thing' |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1931 assert_match('^something$', g:Screenline(&lines)) |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1932 |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1933 echo "some" # comment |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1934 echon "thing" |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1935 assert_match('^something$', g:Screenline(&lines)) |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
1936 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1937 var str1 = 'some' |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1938 var str2 = 'more' |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1939 echo str1 str2 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1940 assert_match('^some more$', g:Screenline(&lines)) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1941 |
28156
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1942 echo "one\ntwo" |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1943 assert_match('^one$', g:Screenline(&lines - 1)) |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1944 assert_match('^two$', g:Screenline(&lines)) |
088d8dc22045
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28154
diff
changeset
|
1945 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1946 v9.CheckDefFailure(['echo "xxx"# comment'], 'E488:') |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1947 enddef |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19521
diff
changeset
|
1948 |
20142
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1949 def Test_echomsg_cmd() |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1950 echomsg 'some' 'more' # comment |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1951 assert_match('^some more$', g:Screenline(&lines)) |
20142
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1952 echo 'clear' |
20982
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
1953 :1messages |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1954 assert_match('^some more$', g:Screenline(&lines)) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1955 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1956 v9.CheckDefFailure(['echomsg "xxx"# comment'], 'E488:') |
20142
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1957 enddef |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1958 |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1959 def Test_echomsg_cmd_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1960 # only checks line continuation |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1961 var lines =<< trim END |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1962 vim9script |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1963 echomsg 'here' |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1964 .. ' is ' .. |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1965 'a message' |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1966 assert_match('^here is a message$', g:Screenline(&lines)) |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1967 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1968 v9.CheckScriptSuccess(lines) |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1969 enddef |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1970 |
20142
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1971 def Test_echoerr_cmd() |
25541
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1972 var local = 'local' |
20289
208b38bddc36
patch 8.2.0700: Vim9: converting error message to exception not tested
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
1973 try |
25541
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1974 echoerr 'something' local 'wrong' # comment |
20289
208b38bddc36
patch 8.2.0700: Vim9: converting error message to exception not tested
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
1975 catch |
25541
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1976 assert_match('something local wrong', v:exception) |
20289
208b38bddc36
patch 8.2.0700: Vim9: converting error message to exception not tested
Bram Moolenaar <Bram@vim.org>
parents:
20203
diff
changeset
|
1977 endtry |
20142
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1978 enddef |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20138
diff
changeset
|
1979 |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1980 def Test_echoerr_cmd_vimscript() |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
1981 # only checks line continuation |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
1982 var lines =<< trim END |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1983 vim9script |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1984 try |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1985 echoerr 'this' |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1986 .. ' is ' .. |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1987 'wrong' |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1988 catch |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1989 assert_match('this is wrong', v:exception) |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1990 endtry |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1991 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
1992 v9.CheckScriptSuccess(lines) |
21098
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1993 enddef |
e88b0daa2fcb
patch 8.2.1100: Vim9: cannot use line break in :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
21096
diff
changeset
|
1994 |
25541
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1995 def Test_echoconsole_cmd() |
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1996 var local = 'local' |
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1997 echoconsole 'something' local # comment |
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1998 # output goes anywhere |
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
1999 enddef |
2ae1d5a4ae5c
patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents:
25537
diff
changeset
|
2000 |
19568
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
2001 def Test_for_outside_of_function() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
2002 var lines =<< trim END |
19568
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
2003 vim9script |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
2004 new |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
2005 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
|
2006 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
|
2007 endfor |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
2008 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
|
2009 bwipe! |
24232
3058ed6db36f
patch 8.2.2657: Vim9: error message for declaring variable in for loop
Bram Moolenaar <Bram@vim.org>
parents:
24158
diff
changeset
|
2010 |
3058ed6db36f
patch 8.2.2657: Vim9: error message for declaring variable in for loop
Bram Moolenaar <Bram@vim.org>
parents:
24158
diff
changeset
|
2011 var result = '' |
3058ed6db36f
patch 8.2.2657: Vim9: error message for declaring variable in for loop
Bram Moolenaar <Bram@vim.org>
parents:
24158
diff
changeset
|
2012 for i in [1, 2, 3] |
3058ed6db36f
patch 8.2.2657: Vim9: error message for declaring variable in for loop
Bram Moolenaar <Bram@vim.org>
parents:
24158
diff
changeset
|
2013 var loop = ' loop ' .. i |
3058ed6db36f
patch 8.2.2657: Vim9: error message for declaring variable in for loop
Bram Moolenaar <Bram@vim.org>
parents:
24158
diff
changeset
|
2014 result ..= loop |
3058ed6db36f
patch 8.2.2657: Vim9: error message for declaring variable in for loop
Bram Moolenaar <Bram@vim.org>
parents:
24158
diff
changeset
|
2015 endfor |
3058ed6db36f
patch 8.2.2657: Vim9: error message for declaring variable in for loop
Bram Moolenaar <Bram@vim.org>
parents:
24158
diff
changeset
|
2016 assert_equal(' loop 1 loop 2 loop 3', result) |
19568
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
2017 END |
c0749ad6c699
patch 8.2.0341: using ":for" in Vim9 script gives an error
Bram Moolenaar <Bram@vim.org>
parents:
19566
diff
changeset
|
2018 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
|
2019 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
|
2020 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
|
2021 enddef |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2022 |
25656
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2023 def Test_for_skipped_block() |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2024 # test skipped blocks at outside of function |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2025 var lines =<< trim END |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2026 var result = [] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2027 if true |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2028 for n in [1, 2] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2029 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2030 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2031 else |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2032 for n in [3, 4] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2033 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2034 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2035 endif |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2036 assert_equal([1, 2], result) |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2037 |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2038 result = [] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2039 if false |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2040 for n in [1, 2] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2041 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2042 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2043 else |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2044 for n in [3, 4] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2045 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2046 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2047 endif |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2048 assert_equal([3, 4], result) |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2049 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2050 v9.CheckDefAndScriptSuccess(lines) |
25656
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2051 |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2052 # test skipped blocks at inside of function |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2053 lines =<< trim END |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2054 def DefTrue() |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2055 var result = [] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2056 if true |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2057 for n in [1, 2] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2058 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2059 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2060 else |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2061 for n in [3, 4] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2062 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2063 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2064 endif |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2065 assert_equal([1, 2], result) |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2066 enddef |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2067 DefTrue() |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2068 |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2069 def DefFalse() |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2070 var result = [] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2071 if false |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2072 for n in [1, 2] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2073 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2074 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2075 else |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2076 for n in [3, 4] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2077 result += [n] |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2078 endfor |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2079 endif |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2080 assert_equal([3, 4], result) |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2081 enddef |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2082 DefFalse() |
28281
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2083 |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2084 def BuildDiagrams() |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2085 var diagrams: list<any> |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2086 if false |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2087 var max = 0 |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2088 for v in diagrams |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2089 var l = 3 |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2090 if max < l | max = l | endif |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2091 v->add(l) |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2092 endfor |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2093 endif |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2094 enddef |
bd1dcc605e58
patch 8.2.4666: Vim9: assignment not recognized in skipped block
Bram Moolenaar <Bram@vim.org>
parents:
28193
diff
changeset
|
2095 BuildDiagrams() |
25656
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2096 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2097 v9.CheckDefAndScriptSuccess(lines) |
25656
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2098 enddef |
fe7f45e2895e
patch 8.2.3364: Vim9: crash when :for is skipped
Bram Moolenaar <Bram@vim.org>
parents:
25654
diff
changeset
|
2099 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
2100 def Test_for_loop() |
24438
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2101 var lines =<< trim END |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2102 var result = '' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2103 for cnt in range(7) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2104 if cnt == 4 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2105 break |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2106 endif |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2107 if cnt == 2 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2108 continue |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2109 endif |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2110 result ..= cnt .. '_' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2111 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2112 assert_equal('0_1_3_', result) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2113 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2114 var concat = '' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2115 for str in eval('["one", "two"]') |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2116 concat ..= str |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2117 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2118 assert_equal('onetwo', concat) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2119 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2120 var total = 0 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2121 for nr in |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2122 [1, 2, 3] |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2123 total += nr |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2124 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2125 assert_equal(6, total) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2126 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2127 total = 0 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2128 for nr |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2129 in [1, 2, 3] |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2130 total += nr |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2131 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2132 assert_equal(6, total) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2133 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2134 total = 0 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2135 for nr |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2136 in |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2137 [1, 2, 3] |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2138 total += nr |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2139 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2140 assert_equal(6, total) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2141 |
24446
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2142 # with type |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2143 total = 0 |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2144 for n: number in [1, 2, 3] |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2145 total += n |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2146 endfor |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2147 assert_equal(6, total) |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2148 |
28154
ae975c8d5438
patch 8.2.4601: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28125
diff
changeset
|
2149 total = 0 |
ae975c8d5438
patch 8.2.4601: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28125
diff
changeset
|
2150 for b in 0z010203 |
ae975c8d5438
patch 8.2.4601: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28125
diff
changeset
|
2151 total += b |
ae975c8d5438
patch 8.2.4601: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28125
diff
changeset
|
2152 endfor |
ae975c8d5438
patch 8.2.4601: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28125
diff
changeset
|
2153 assert_equal(6, total) |
ae975c8d5438
patch 8.2.4601: Vim9: not enough test coverage for executing :def function
Bram Moolenaar <Bram@vim.org>
parents:
28125
diff
changeset
|
2154 |
24460
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2155 var chars = '' |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2156 for s: string in 'foobar' |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2157 chars ..= s |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2158 endfor |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2159 assert_equal('foobar', chars) |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2160 |
25164
0e08e34fa0b8
patch 8.2.3118: Vim9: "any" type not handled correctly in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25162
diff
changeset
|
2161 chars = '' |
0e08e34fa0b8
patch 8.2.3118: Vim9: "any" type not handled correctly in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25162
diff
changeset
|
2162 for x: string in {a: 'a', b: 'b'}->values() |
0e08e34fa0b8
patch 8.2.3118: Vim9: "any" type not handled correctly in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25162
diff
changeset
|
2163 chars ..= x |
0e08e34fa0b8
patch 8.2.3118: Vim9: "any" type not handled correctly in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25162
diff
changeset
|
2164 endfor |
0e08e34fa0b8
patch 8.2.3118: Vim9: "any" type not handled correctly in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25162
diff
changeset
|
2165 assert_equal('ab', chars) |
0e08e34fa0b8
patch 8.2.3118: Vim9: "any" type not handled correctly in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25162
diff
changeset
|
2166 |
24446
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2167 # unpack with type |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2168 var res = '' |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2169 for [n: number, s: string] in [[1, 'a'], [2, 'b']] |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2170 res ..= n .. s |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2171 endfor |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2172 assert_equal('1a2b', res) |
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2173 |
25028
faa3de7aed8b
patch 8.2.3051: Vim9: for loop with one list variable does not work
Bram Moolenaar <Bram@vim.org>
parents:
24968
diff
changeset
|
2174 # unpack with one var |
faa3de7aed8b
patch 8.2.3051: Vim9: for loop with one list variable does not work
Bram Moolenaar <Bram@vim.org>
parents:
24968
diff
changeset
|
2175 var reslist = [] |
faa3de7aed8b
patch 8.2.3051: Vim9: for loop with one list variable does not work
Bram Moolenaar <Bram@vim.org>
parents:
24968
diff
changeset
|
2176 for [x] in [['aaa'], ['bbb']] |
faa3de7aed8b
patch 8.2.3051: Vim9: for loop with one list variable does not work
Bram Moolenaar <Bram@vim.org>
parents:
24968
diff
changeset
|
2177 reslist->add(x) |
faa3de7aed8b
patch 8.2.3051: Vim9: for loop with one list variable does not work
Bram Moolenaar <Bram@vim.org>
parents:
24968
diff
changeset
|
2178 endfor |
faa3de7aed8b
patch 8.2.3051: Vim9: for loop with one list variable does not work
Bram Moolenaar <Bram@vim.org>
parents:
24968
diff
changeset
|
2179 assert_equal(['aaa', 'bbb'], reslist) |
faa3de7aed8b
patch 8.2.3051: Vim9: for loop with one list variable does not work
Bram Moolenaar <Bram@vim.org>
parents:
24968
diff
changeset
|
2180 |
24438
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2181 # loop over string |
24446
f388a033e568
patch 8.2.2763: Vim9: cannot use type in for loop unpack at script level
Bram Moolenaar <Bram@vim.org>
parents:
24440
diff
changeset
|
2182 res = '' |
24438
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2183 for c in 'aéc̀d' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2184 res ..= c .. '-' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2185 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2186 assert_equal('a-é-c̀-d-', res) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2187 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2188 res = '' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2189 for c in '' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2190 res ..= c .. '-' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2191 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2192 assert_equal('', res) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2193 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2194 res = '' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2195 for c in test_null_string() |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2196 res ..= c .. '-' |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2197 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2198 assert_equal('', res) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2199 |
28305
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2200 total = 0 |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2201 for c in null_list |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2202 total += 1 |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2203 endfor |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2204 assert_equal(0, total) |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2205 |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2206 for c in null_blob |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2207 total += 1 |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2208 endfor |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2209 assert_equal(0, total) |
c4b2aa8e1ee1
patch 8.2.4678: Vim9: not all code is tested
Bram Moolenaar <Bram@vim.org>
parents:
28299
diff
changeset
|
2210 |
24438
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2211 var foo: list<dict<any>> = [ |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2212 {a: 'Cat'} |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2213 ] |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2214 for dd in foo |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2215 dd.counter = 12 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2216 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2217 assert_equal([{a: 'Cat', counter: 12}], foo) |
25280
ca7a8ea2eb5f
patch 8.2.3177: Vim9: can not use "for _ in expr" at script level
Bram Moolenaar <Bram@vim.org>
parents:
25260
diff
changeset
|
2218 |
ca7a8ea2eb5f
patch 8.2.3177: Vim9: can not use "for _ in expr" at script level
Bram Moolenaar <Bram@vim.org>
parents:
25260
diff
changeset
|
2219 reslist = [] |
ca7a8ea2eb5f
patch 8.2.3177: Vim9: can not use "for _ in expr" at script level
Bram Moolenaar <Bram@vim.org>
parents:
25260
diff
changeset
|
2220 for _ in range(3) |
ca7a8ea2eb5f
patch 8.2.3177: Vim9: can not use "for _ in expr" at script level
Bram Moolenaar <Bram@vim.org>
parents:
25260
diff
changeset
|
2221 reslist->add('x') |
ca7a8ea2eb5f
patch 8.2.3177: Vim9: can not use "for _ in expr" at script level
Bram Moolenaar <Bram@vim.org>
parents:
25260
diff
changeset
|
2222 endfor |
ca7a8ea2eb5f
patch 8.2.3177: Vim9: can not use "for _ in expr" at script level
Bram Moolenaar <Bram@vim.org>
parents:
25260
diff
changeset
|
2223 assert_equal(['x', 'x', 'x'], reslist) |
24438
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2224 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2225 v9.CheckDefAndScriptSuccess(lines) |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
2226 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
2227 |
25358
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2228 def Test_for_loop_with_closure() |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2229 var lines =<< trim END |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2230 var flist: list<func> |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2231 for i in range(5) |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2232 var inloop = i |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2233 flist[i] = () => inloop |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2234 endfor |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2235 for i in range(5) |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2236 assert_equal(4, flist[i]()) |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2237 endfor |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2238 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2239 v9.CheckDefAndScriptSuccess(lines) |
25358
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2240 |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2241 lines =<< trim END |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2242 var flist: list<func> |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2243 for i in range(5) |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2244 var inloop = i |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2245 flist[i] = () => { |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2246 return inloop |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2247 } |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2248 endfor |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2249 for i in range(5) |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2250 assert_equal(4, flist[i]()) |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2251 endfor |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2252 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2253 v9.CheckDefAndScriptSuccess(lines) |
25358
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2254 enddef |
f03271631eb5
patch 8.2.3216: Vim9: crash when using variable in a loop at script level
Bram Moolenaar <Bram@vim.org>
parents:
25304
diff
changeset
|
2255 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
2256 def Test_for_loop_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2257 v9.CheckDefAndScriptFailure(['for '], ['E1097:', 'E690:']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2258 v9.CheckDefAndScriptFailure(['for x'], ['E1097:', 'E690:']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2259 v9.CheckDefAndScriptFailure(['for x in'], ['E1097:', 'E15:']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2260 v9.CheckDefAndScriptFailure(['for # in range(5)'], 'E690:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2261 v9.CheckDefAndScriptFailure(['for i In range(5)'], 'E690:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2262 v9.CheckDefAndScriptFailure(['var x = 5', 'for x in range(5)', 'endfor'], ['E1017:', 'E1041:']) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2263 v9.CheckScriptFailure(['vim9script', 'var x = 5', 'for x in range(5)', '# comment', 'endfor'], 'E1041:', 3) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2264 v9.CheckScriptFailure(['def Func(arg: any)', 'for arg in range(5)', 'enddef', 'defcompile'], 'E1006:') |
23092
c713358da074
patch 8.2.2092: Vim9: unpredictable errors for script tests
Bram Moolenaar <Bram@vim.org>
parents:
23084
diff
changeset
|
2265 delfunc! g:Func |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2266 v9.CheckDefFailure(['for i in xxx'], 'E1001:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2267 v9.CheckDefFailure(['endfor'], 'E588:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2268 v9.CheckDefFailure(['for i in range(3)', 'echo 3'], 'E170:') |
24234
7ffc795288dd
patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents:
24232
diff
changeset
|
2269 |
7ffc795288dd
patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents:
24232
diff
changeset
|
2270 # wrong type detected at compile time |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2271 v9.CheckDefFailure(['for i in {a: 1}', 'echo 3', 'endfor'], 'E1177: For loop on dict not supported') |
24234
7ffc795288dd
patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents:
24232
diff
changeset
|
2272 |
7ffc795288dd
patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents:
24232
diff
changeset
|
2273 # wrong type detected at runtime |
7ffc795288dd
patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents:
24232
diff
changeset
|
2274 g:adict = {a: 1} |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2275 v9.CheckDefExecFailure(['for i in g:adict', 'echo 3', 'endfor'], 'E1177: For loop on dict not supported') |
24234
7ffc795288dd
patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents:
24232
diff
changeset
|
2276 unlet g:adict |
24440
d2f9bdd938fa
patch 8.2.2760: Vim9: no error for changing a for loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24438
diff
changeset
|
2277 |
d2f9bdd938fa
patch 8.2.2760: Vim9: no error for changing a for loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24438
diff
changeset
|
2278 var lines =<< trim END |
d2f9bdd938fa
patch 8.2.2760: Vim9: no error for changing a for loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24438
diff
changeset
|
2279 var d: list<dict<any>> = [{a: 0}] |
d2f9bdd938fa
patch 8.2.2760: Vim9: no error for changing a for loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24438
diff
changeset
|
2280 for e in d |
d2f9bdd938fa
patch 8.2.2760: Vim9: no error for changing a for loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24438
diff
changeset
|
2281 e = {a: 0, b: ''} |
d2f9bdd938fa
patch 8.2.2760: Vim9: no error for changing a for loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24438
diff
changeset
|
2282 endfor |
d2f9bdd938fa
patch 8.2.2760: Vim9: no error for changing a for loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24438
diff
changeset
|
2283 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2284 v9.CheckDefAndScriptFailure(lines, ['E1018:', 'E46:'], 3) |
24460
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2285 |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2286 lines =<< trim END |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2287 for nr: number in ['foo'] |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2288 endfor |
f0a3adf16f01
patch 8.2.2770: Vim9: type of loop variable is not used
Bram Moolenaar <Bram@vim.org>
parents:
24446
diff
changeset
|
2289 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2290 v9.CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected number but got string', 1) |
25149
18b31f0a4bb5
patch 8.2.3111: Vim9: confusing error with extra whitespace before colon
Bram Moolenaar <Bram@vim.org>
parents:
25124
diff
changeset
|
2291 |
18b31f0a4bb5
patch 8.2.3111: Vim9: confusing error with extra whitespace before colon
Bram Moolenaar <Bram@vim.org>
parents:
25124
diff
changeset
|
2292 lines =<< trim END |
18b31f0a4bb5
patch 8.2.3111: Vim9: confusing error with extra whitespace before colon
Bram Moolenaar <Bram@vim.org>
parents:
25124
diff
changeset
|
2293 for n : number in [1, 2] |
18b31f0a4bb5
patch 8.2.3111: Vim9: confusing error with extra whitespace before colon
Bram Moolenaar <Bram@vim.org>
parents:
25124
diff
changeset
|
2294 echo n |
18b31f0a4bb5
patch 8.2.3111: Vim9: confusing error with extra whitespace before colon
Bram Moolenaar <Bram@vim.org>
parents:
25124
diff
changeset
|
2295 endfor |
18b31f0a4bb5
patch 8.2.3111: Vim9: confusing error with extra whitespace before colon
Bram Moolenaar <Bram@vim.org>
parents:
25124
diff
changeset
|
2296 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2297 v9.CheckDefAndScriptFailure(lines, 'E1059:', 1) |
25162
c44d6ac81c42
patch 8.2.3117: Vim9: type not properly checked in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25153
diff
changeset
|
2298 |
c44d6ac81c42
patch 8.2.3117: Vim9: type not properly checked in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25153
diff
changeset
|
2299 lines =<< trim END |
c44d6ac81c42
patch 8.2.3117: Vim9: type not properly checked in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25153
diff
changeset
|
2300 var d: dict<number> = {a: 1, b: 2} |
c44d6ac81c42
patch 8.2.3117: Vim9: type not properly checked in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25153
diff
changeset
|
2301 for [k: job, v: job] in d->items() |
c44d6ac81c42
patch 8.2.3117: Vim9: type not properly checked in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25153
diff
changeset
|
2302 echo k v |
c44d6ac81c42
patch 8.2.3117: Vim9: type not properly checked in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25153
diff
changeset
|
2303 endfor |
c44d6ac81c42
patch 8.2.3117: Vim9: type not properly checked in for loop
Bram Moolenaar <Bram@vim.org>
parents:
25153
diff
changeset
|
2304 END |
28901
11609f025219
patch 8.2.4973: Vim9: type error for list unpack mentions argument
Bram Moolenaar <Bram@vim.org>
parents:
28735
diff
changeset
|
2305 v9.CheckDefExecAndScriptFailure(lines, ['E1163: Variable 1: type mismatch, expected job but got string', 'E1012: Type mismatch; expected job but got string'], 2) |
26238
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2306 |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2307 lines =<< trim END |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2308 var i = 0 |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2309 for i in [1, 2, 3] |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2310 echo i |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2311 endfor |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2312 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2313 v9.CheckDefExecAndScriptFailure(lines, ['E1017:', 'E1041:']) |
26238
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2314 |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2315 lines =<< trim END |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2316 var l = [0] |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2317 for l[0] in [1, 2, 3] |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2318 echo l[0] |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2319 endfor |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2320 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2321 v9.CheckDefExecAndScriptFailure(lines, ['E461:', 'E1017:']) |
26238
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2322 |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2323 lines =<< trim END |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2324 var d = {x: 0} |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2325 for d.x in [1, 2, 3] |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2326 echo d.x |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2327 endfor |
14b4c778b61e
patch 8.2.3650: Vim9: for loop variable can be a list member
Bram Moolenaar <Bram@vim.org>
parents:
26236
diff
changeset
|
2328 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2329 v9.CheckDefExecAndScriptFailure(lines, ['E461:', 'E1017:']) |
27515
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2330 |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2331 lines =<< trim END |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2332 var l: list<dict<any>> = [{a: 1, b: 'x'}] |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2333 for item: dict<number> in l |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2334 echo item |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2335 endfor |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2336 END |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2337 v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<number> but got dict<any>') |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2338 |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2339 lines =<< trim END |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2340 var l: list<dict<any>> = [{n: 1}] |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2341 for item: dict<number> in l |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2342 item->extend({s: ''}) |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2343 endfor |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2344 END |
1aff400b819e
patch 8.2.4285: Vim9: type of item in for loop not checked properly
Bram Moolenaar <Bram@vim.org>
parents:
27472
diff
changeset
|
2345 v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected dict<number> but got dict<string>') |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
2346 enddef |
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
2347 |
23068
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2348 def Test_for_loop_script_var() |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2349 # cannot use s:var in a :def function |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2350 v9.CheckDefFailure(['for s:var in range(3)', 'echo 3'], 'E1254:') |
23068
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2351 |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2352 # can use s:var in Vim9 script, with or without s: |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2353 var lines =<< trim END |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2354 vim9script |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2355 var total = 0 |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2356 for s:var in [1, 2, 3] |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2357 total += s:var |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2358 endfor |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2359 assert_equal(6, total) |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2360 |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2361 total = 0 |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2362 for var in [1, 2, 3] |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2363 total += var |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2364 endfor |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2365 assert_equal(6, total) |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2366 END |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2367 enddef |
2f034cb0a046
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Bram Moolenaar <Bram@vim.org>
parents:
23066
diff
changeset
|
2368 |
22975
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2369 def Test_for_loop_unpack() |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2370 var lines =<< trim END |
23054
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2371 var result = [] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2372 for [v1, v2] in [[1, 2], [3, 4]] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2373 result->add(v1) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2374 result->add(v2) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2375 endfor |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2376 assert_equal([1, 2, 3, 4], result) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2377 |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2378 result = [] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2379 for [v1, v2; v3] in [[1, 2], [3, 4, 5, 6]] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2380 result->add(v1) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2381 result->add(v2) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2382 result->add(v3) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2383 endfor |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2384 assert_equal([1, 2, [], 3, 4, [5, 6]], result) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2385 |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2386 result = [] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2387 for [&ts, &sw] in [[1, 2], [3, 4]] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2388 result->add(&ts) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2389 result->add(&sw) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2390 endfor |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2391 assert_equal([1, 2, 3, 4], result) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2392 |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2393 var slist: list<string> |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2394 for [$LOOPVAR, @r, v:errmsg] in [['a', 'b', 'c'], ['d', 'e', 'f']] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2395 slist->add($LOOPVAR) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2396 slist->add(@r) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2397 slist->add(v:errmsg) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2398 endfor |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2399 assert_equal(['a', 'b', 'c', 'd', 'e', 'f'], slist) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2400 |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2401 slist = [] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2402 for [g:globalvar, b:bufvar, w:winvar, t:tabvar] in [['global', 'buf', 'win', 'tab'], ['1', '2', '3', '4']] |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2403 slist->add(g:globalvar) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2404 slist->add(b:bufvar) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2405 slist->add(w:winvar) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2406 slist->add(t:tabvar) |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2407 endfor |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2408 assert_equal(['global', 'buf', 'win', 'tab', '1', '2', '3', '4'], slist) |
23084
49c9aa9e40d4
patch 8.2.2088: Vim9: script test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
2409 unlet! g:globalvar b:bufvar w:winvar t:tabvar |
24679
80422f66978a
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Bram Moolenaar <Bram@vim.org>
parents:
24555
diff
changeset
|
2410 |
80422f66978a
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Bram Moolenaar <Bram@vim.org>
parents:
24555
diff
changeset
|
2411 var res = [] |
80422f66978a
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Bram Moolenaar <Bram@vim.org>
parents:
24555
diff
changeset
|
2412 for [_, n, _] in [[1, 2, 3], [4, 5, 6]] |
80422f66978a
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Bram Moolenaar <Bram@vim.org>
parents:
24555
diff
changeset
|
2413 res->add(n) |
80422f66978a
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Bram Moolenaar <Bram@vim.org>
parents:
24555
diff
changeset
|
2414 endfor |
80422f66978a
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Bram Moolenaar <Bram@vim.org>
parents:
24555
diff
changeset
|
2415 assert_equal([2, 5], res) |
28125
ed151877ebac
patch 8.2.4587: Vim9: double free after unpacking a list
Bram Moolenaar <Bram@vim.org>
parents:
28117
diff
changeset
|
2416 |
ed151877ebac
patch 8.2.4587: Vim9: double free after unpacking a list
Bram Moolenaar <Bram@vim.org>
parents:
28117
diff
changeset
|
2417 var text: list<string> = ["hello there", "goodbye now"] |
ed151877ebac
patch 8.2.4587: Vim9: double free after unpacking a list
Bram Moolenaar <Bram@vim.org>
parents:
28117
diff
changeset
|
2418 var splitted = '' |
ed151877ebac
patch 8.2.4587: Vim9: double free after unpacking a list
Bram Moolenaar <Bram@vim.org>
parents:
28117
diff
changeset
|
2419 for [first; next] in mapnew(text, (i, v) => split(v)) |
ed151877ebac
patch 8.2.4587: Vim9: double free after unpacking a list
Bram Moolenaar <Bram@vim.org>
parents:
28117
diff
changeset
|
2420 splitted ..= string(first) .. string(next) .. '/' |
ed151877ebac
patch 8.2.4587: Vim9: double free after unpacking a list
Bram Moolenaar <Bram@vim.org>
parents:
28117
diff
changeset
|
2421 endfor |
ed151877ebac
patch 8.2.4587: Vim9: double free after unpacking a list
Bram Moolenaar <Bram@vim.org>
parents:
28117
diff
changeset
|
2422 assert_equal("'hello'['there']/'goodbye'['now']/", splitted) |
23054
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2423 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2424 v9.CheckDefAndScriptSuccess(lines) |
23054
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2425 |
df0548b649c1
patch 8.2.2073: Vim9: for with unpack only works for local variables
Bram Moolenaar <Bram@vim.org>
parents:
22975
diff
changeset
|
2426 lines =<< trim END |
22975
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2427 for [v1, v2] in [[1, 2, 3], [3, 4]] |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2428 echo v1 v2 |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2429 endfor |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2430 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2431 v9.CheckDefExecFailure(lines, 'E710:', 1) |
22975
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2432 |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2433 lines =<< trim END |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2434 for [v1, v2] in [[1], [3, 4]] |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2435 echo v1 v2 |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2436 endfor |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2437 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2438 v9.CheckDefExecFailure(lines, 'E711:', 1) |
22975
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2439 |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2440 lines =<< trim END |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2441 for [v1, v1] in [[1, 2], [3, 4]] |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2442 echo v1 |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2443 endfor |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2444 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2445 v9.CheckDefExecFailure(lines, 'E1017:', 1) |
28623
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2446 |
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2447 lines =<< trim END |
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2448 for [a, b] in g:listlist |
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2449 echo a |
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2450 endfor |
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2451 END |
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2452 g:listlist = [1, 2, 3] |
1d92ba691dc4
patch 8.2.4835: Vim9: some lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
28570
diff
changeset
|
2453 v9.CheckDefExecFailure(lines, 'E1140:', 1) |
22975
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2454 enddef |
a943b175586a
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents:
22936
diff
changeset
|
2455 |
23927
5e5780e3f75d
patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents:
23921
diff
changeset
|
2456 def Test_for_loop_with_try_continue() |
24438
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2457 var lines =<< trim END |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2458 var looped = 0 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2459 var cleanup = 0 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2460 for i in range(3) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2461 looped += 1 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2462 try |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2463 eval [][0] |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2464 catch |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2465 continue |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2466 finally |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2467 cleanup += 1 |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2468 endtry |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2469 endfor |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2470 assert_equal(3, looped) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2471 assert_equal(3, cleanup) |
5c6ccab68d1e
patch 8.2.2759: Vim9: for loop infers type of loop variable
Bram Moolenaar <Bram@vim.org>
parents:
24418
diff
changeset
|
2472 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2473 v9.CheckDefAndScriptSuccess(lines) |
23927
5e5780e3f75d
patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents:
23921
diff
changeset
|
2474 enddef |
5e5780e3f75d
patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents:
23921
diff
changeset
|
2475 |
25650
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2476 def Test_while_skipped_block() |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2477 # test skipped blocks at outside of function |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2478 var lines =<< trim END |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2479 var result = [] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2480 var n = 0 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2481 if true |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2482 n = 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2483 while n < 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2484 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2485 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2486 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2487 else |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2488 n = 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2489 while n < 5 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2490 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2491 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2492 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2493 endif |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2494 assert_equal([1, 2], result) |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2495 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2496 result = [] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2497 if false |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2498 n = 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2499 while n < 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2500 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2501 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2502 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2503 else |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2504 n = 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2505 while n < 5 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2506 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2507 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2508 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2509 endif |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2510 assert_equal([3, 4], result) |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2511 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2512 v9.CheckDefAndScriptSuccess(lines) |
25650
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2513 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2514 # test skipped blocks at inside of function |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2515 lines =<< trim END |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2516 def DefTrue() |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2517 var result = [] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2518 var n = 0 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2519 if true |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2520 n = 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2521 while n < 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2522 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2523 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2524 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2525 else |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2526 n = 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2527 while n < 5 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2528 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2529 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2530 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2531 endif |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2532 assert_equal([1, 2], result) |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2533 enddef |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2534 DefTrue() |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2535 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2536 def DefFalse() |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2537 var result = [] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2538 var n = 0 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2539 if false |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2540 n = 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2541 while n < 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2542 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2543 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2544 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2545 else |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2546 n = 3 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2547 while n < 5 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2548 result += [n] |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2549 n += 1 |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2550 endwhile |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2551 endif |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2552 assert_equal([3, 4], result) |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2553 enddef |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2554 DefFalse() |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2555 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2556 v9.CheckDefAndScriptSuccess(lines) |
25650
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2557 enddef |
6ed39aa92cb9
patch 8.2.3361: Vim9: crash with nested :while
Bram Moolenaar <Bram@vim.org>
parents:
25634
diff
changeset
|
2558 |
19593
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2559 def Test_while_loop() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
2560 var result = '' |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
2561 var cnt = 0 |
19593
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2562 while cnt < 555 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2563 if cnt == 3 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2564 break |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2565 endif |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2566 cnt += 1 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2567 if cnt == 2 |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2568 continue |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2569 endif |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2570 result ..= cnt .. '_' |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2571 endwhile |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2572 assert_equal('1_3_', result) |
23884
00e904bdb8a5
patch 8.2.2484: Vim9: Cannot use a comment starting with #{
Bram Moolenaar <Bram@vim.org>
parents:
23882
diff
changeset
|
2573 |
00e904bdb8a5
patch 8.2.2484: Vim9: Cannot use a comment starting with #{
Bram Moolenaar <Bram@vim.org>
parents:
23882
diff
changeset
|
2574 var s = '' |
24158
93e69703a290
patch 8.2.2620: Vim9: Using #{ for a dictionary gives strange errors
Bram Moolenaar <Bram@vim.org>
parents:
24150
diff
changeset
|
2575 while s == 'x' # {comment} |
23884
00e904bdb8a5
patch 8.2.2484: Vim9: Cannot use a comment starting with #{
Bram Moolenaar <Bram@vim.org>
parents:
23882
diff
changeset
|
2576 endwhile |
19593
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2577 enddef |
043989a2f449
patch 8.2.0353: Vim9: while loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19585
diff
changeset
|
2578 |
26236
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2579 def Test_while_loop_in_script() |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2580 var lines =<< trim END |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2581 vim9script |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2582 var result = '' |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2583 var cnt = 0 |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2584 while cnt < 3 |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2585 var s = 'v' .. cnt |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2586 result ..= s |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2587 cnt += 1 |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2588 endwhile |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2589 assert_equal('v0v1v2', result) |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2590 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2591 v9.CheckScriptSuccess(lines) |
26236
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2592 enddef |
9e6ddd7b91cd
patch 8.2.3649: Vim9: error for variable declared in while loop
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
2593 |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19890
diff
changeset
|
2594 def Test_while_loop_fails() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2595 v9.CheckDefFailure(['while xxx'], 'E1001:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2596 v9.CheckDefFailure(['endwhile'], 'E588:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2597 v9.CheckDefFailure(['continue'], 'E586:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2598 v9.CheckDefFailure(['if true', 'continue'], 'E586:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2599 v9.CheckDefFailure(['break'], 'E587:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2600 v9.CheckDefFailure(['if true', 'break'], 'E587:') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2601 v9.CheckDefFailure(['while 1', 'echo 3'], 'E170:') |
23882
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
2602 |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
2603 var lines =<< trim END |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
2604 var s = '' |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
2605 while s = '' |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
2606 endwhile |
a4df35126d9c
patch 8.2.2483: Vim9: type error for misformed expression
Bram Moolenaar <Bram@vim.org>
parents:
23827
diff
changeset
|
2607 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2608 v9.CheckDefFailure(lines, 'E488:') |
19862
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19860
diff
changeset
|
2609 enddef |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19860
diff
changeset
|
2610 |
19730
fe8ba2f82f59
patch 8.2.0421: interrupting with CTRL-C does not always work
Bram Moolenaar <Bram@vim.org>
parents:
19728
diff
changeset
|
2611 def Test_interrupt_loop() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
2612 var caught = false |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
2613 var x = 0 |
19736
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2614 try |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2615 while 1 |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2616 x += 1 |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2617 if x == 100 |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2618 feedkeys("\<C-C>", 'Lt') |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2619 endif |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2620 endwhile |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2621 catch |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2622 caught = true |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2623 assert_equal(100, x) |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2624 endtry |
4174c4da6ff7
patch 8.2.0424: checking for wrong return value
Bram Moolenaar <Bram@vim.org>
parents:
19730
diff
changeset
|
2625 assert_true(caught, 'should have caught an exception') |
21987
c33cec63cf53
patch 8.2.1543: Vim9: test with invalid SID is skipped in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21985
diff
changeset
|
2626 # consume the CTRL-C |
c33cec63cf53
patch 8.2.1543: Vim9: test with invalid SID is skipped in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21985
diff
changeset
|
2627 getchar(0) |
19730
fe8ba2f82f59
patch 8.2.0421: interrupting with CTRL-C does not always work
Bram Moolenaar <Bram@vim.org>
parents:
19728
diff
changeset
|
2628 enddef |
19726
ad37a198a708
patch 8.2.0419: various memory leaks in Vim9 script code
Bram Moolenaar <Bram@vim.org>
parents:
19623
diff
changeset
|
2629 |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2630 def Test_automatic_line_continuation() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
2631 var mylist = [ |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2632 'one', |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2633 'two', |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2634 'three', |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
2635 ] # comment |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2636 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
|
2637 |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
2638 var mydict = { |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2639 ['one']: 1, |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2640 ['two']: 2, |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2641 ['three']: |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2642 3, |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
2643 } # comment |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2644 assert_equal({one: 1, two: 2, three: 3}, mydict) |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2645 mydict = { |
20023
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2646 one: 1, # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2647 two: # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2648 2, # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2649 three: 3 # comment |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2650 } |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2651 assert_equal({one: 1, two: 2, three: 3}, mydict) |
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2652 mydict = { |
20023
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2653 one: 1, |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2654 two: |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2655 2, |
c85d4e173cc9
patch 8.2.0567: Vim9: cannot put comments halfway expressions
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
2656 three: 3 |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2657 } |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
2658 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
|
2659 |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
2660 assert_equal( |
628011800942
patch 8.2.0561: Vim9: cannot split function call in multiple lines
Bram Moolenaar <Bram@vim.org>
parents:
19999
diff
changeset
|
2661 ['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
|
2662 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
|
2663 ) |
19999
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2664 enddef |
844c7646f61b
patch 8.2.0555: Vim9: line continuation is not always needed
Bram Moolenaar <Bram@vim.org>
parents:
19962
diff
changeset
|
2665 |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2666 def Test_vim9_comment() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2667 v9.CheckScriptSuccess([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2668 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2669 '# something', |
23179
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2670 '#something', |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2671 '#{something', |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2672 ]) |
23179
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2673 |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2674 split Xfile |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2675 v9.CheckScriptSuccess([ |
23179
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2676 'vim9script', |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2677 'edit #something', |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2678 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2679 v9.CheckScriptSuccess([ |
23179
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2680 'vim9script', |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2681 'edit #{something', |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2682 ]) |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2683 close |
821701ecbde7
patch 8.2.2135: Vim9: #{ still seen as start of dict in some places
Bram Moolenaar <Bram@vim.org>
parents:
23162
diff
changeset
|
2684 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2685 v9.CheckScriptFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2686 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2687 ':# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2688 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2689 v9.CheckScriptFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2690 '# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2691 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2692 v9.CheckScriptFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2693 ':# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2694 ], 'E488:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2695 |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2696 { # block start |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2697 } # block end |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2698 v9.CheckDefFailure([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2699 '{# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2700 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2701 v9.CheckDefFailure([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2702 '{', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2703 '}# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2704 ], 'E488:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2705 |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2706 echo "yes" # comment |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2707 v9.CheckDefFailure([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2708 'echo "yes"# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2709 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2710 v9.CheckScriptSuccess([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2711 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2712 'echo "yes" # something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2713 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2714 v9.CheckScriptFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2715 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2716 'echo "yes"# something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2717 ], 'E121:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2718 v9.CheckScriptFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2719 'vim9script', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2720 'echo# something', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2721 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2722 v9.CheckScriptFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2723 'echo "yes" # something', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2724 ], 'E121:') |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2725 |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2726 exe "echo" # comment |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2727 v9.CheckDefFailure([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2728 'exe "echo"# comment', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2729 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2730 v9.CheckScriptSuccess([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2731 'vim9script', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2732 'exe "echo" # something', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2733 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2734 v9.CheckScriptFailure([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2735 'vim9script', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2736 'exe "echo"# something', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2737 ], 'E121:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2738 v9.CheckScriptFailure([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2739 'vim9script', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2740 'exe# something', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2741 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2742 v9.CheckScriptFailure([ |
20061
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2743 'exe "echo" # something', |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2744 ], 'E121:') |
6e6a75800884
patch 8.2.0586: Vim9: # comment not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20059
diff
changeset
|
2745 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2746 v9.CheckDefFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2747 'try# comment', |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2748 ' echo "yes"', |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2749 'catch', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2750 'endtry', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2751 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2752 v9.CheckScriptFailure([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2753 'vim9script', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2754 'try# comment', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2755 'echo "yes"', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2756 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2757 v9.CheckDefFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2758 'try', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2759 ' throw#comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2760 'catch', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2761 'endtry', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2762 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2763 v9.CheckDefFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2764 'try', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2765 ' throw "yes"#comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2766 'catch', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2767 'endtry', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2768 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2769 v9.CheckDefFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2770 'try', |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2771 ' echo "yes"', |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2772 'catch# comment', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2773 'endtry', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2774 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2775 v9.CheckScriptFailure([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2776 'vim9script', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2777 'try', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2778 ' echo "yes"', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2779 'catch# comment', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2780 'endtry', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2781 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2782 v9.CheckDefFailure([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2783 'try', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2784 ' echo "yes"', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2785 'catch /pat/# comment', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2786 'endtry', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2787 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2788 v9.CheckDefFailure([ |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2789 'try', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2790 'echo "yes"', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2791 'catch', |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
2792 'endtry# comment', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2793 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2794 v9.CheckScriptFailure([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2795 'vim9script', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2796 'try', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2797 ' echo "yes"', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2798 'catch', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2799 'endtry# comment', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2800 ], 'E1144:') |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2801 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2802 v9.CheckScriptSuccess([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2803 'vim9script', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2804 'hi # comment', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2805 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2806 v9.CheckScriptFailure([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2807 'vim9script', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
2808 'hi# comment', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2809 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2810 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2811 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2812 'hi Search # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2813 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2814 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2815 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2816 'hi Search# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2817 ], 'E416:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2818 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2819 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2820 'hi link This Search # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2821 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2822 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2823 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2824 'hi link This That# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2825 ], 'E413:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2826 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2827 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2828 'hi clear This # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2829 'hi clear # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2830 ]) |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
2831 # not tested, because it doesn't give an error but a warning: |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
2832 # hi clear This# comment', |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2833 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2834 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2835 'hi clear# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2836 ], 'E416:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2837 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2838 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2839 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2840 'hi Group term=bold', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2841 'match Group /todo/ # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2842 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2843 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2844 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2845 'hi Group term=bold', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2846 'match Group /todo/# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2847 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2848 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2849 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2850 'match # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2851 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2852 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2853 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2854 'match# comment', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2855 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2856 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2857 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2858 'match none # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2859 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2860 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2861 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2862 'match none# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2863 ], 'E475:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2864 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2865 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2866 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2867 'menutrans clear # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2868 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2869 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2870 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2871 'menutrans clear# comment text', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2872 ], 'E474:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2873 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2874 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2875 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2876 'syntax clear # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2877 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2878 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2879 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2880 'syntax clear# comment text', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2881 ], 'E28:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2882 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2883 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2884 'syntax keyword Word some', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2885 'syntax clear Word # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2886 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2887 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2888 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2889 'syntax keyword Word some', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2890 'syntax clear Word# comment text', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2891 ], 'E28:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2892 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2893 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2894 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2895 'syntax list # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2896 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2897 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2898 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2899 'syntax list# comment text', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2900 ], 'E28:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2901 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2902 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2903 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2904 'syntax match Word /pat/ oneline # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2905 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2906 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2907 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2908 'syntax match Word /pat/ oneline# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2909 ], 'E475:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2910 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2911 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2912 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2913 'syntax keyword Word word # comm[ent', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2914 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2915 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2916 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2917 'syntax keyword Word word# comm[ent', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2918 ], 'E789:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2919 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2920 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2921 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2922 'syntax match Word /pat/ # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2923 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2924 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2925 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2926 'syntax match Word /pat/# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2927 ], 'E402:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2928 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2929 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2930 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2931 'syntax match Word /pat/ contains=Something # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2932 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2933 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2934 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2935 'syntax match Word /pat/ contains=Something# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2936 ], 'E475:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2937 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2938 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2939 'syntax match Word /pat/ contains= # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2940 ], 'E406:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2941 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2942 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2943 'syntax match Word /pat/ contains=# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2944 ], 'E475:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2945 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2946 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2947 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2948 'syntax region Word start=/pat/ end=/pat/ # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2949 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2950 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2951 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2952 'syntax region Word start=/pat/ end=/pat/# comment', |
21375
92e2ed2a2778
patch 8.2.1238: Vim9: a few remaining errors not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents:
21371
diff
changeset
|
2953 ], 'E402:') |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2954 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2955 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2956 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2957 'syntax sync # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2958 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2959 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2960 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2961 'syntax sync# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2962 ], 'E404:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2963 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2964 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2965 'syntax sync ccomment # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2966 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2967 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2968 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2969 'syntax sync ccomment# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2970 ], 'E404:') |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2971 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2972 v9.CheckScriptSuccess([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2973 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2974 'syntax cluster Some contains=Word # comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2975 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2976 v9.CheckScriptFailure([ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2977 'vim9script', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2978 'syntax cluster Some contains=Word# comment', |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
2979 ], 'E475:') |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2980 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2981 v9.CheckScriptSuccess([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2982 'vim9script', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2983 'command Echo echo # comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2984 'command Echo # comment', |
23092
c713358da074
patch 8.2.2092: Vim9: unpredictable errors for script tests
Bram Moolenaar <Bram@vim.org>
parents:
23084
diff
changeset
|
2985 'delcommand Echo', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2986 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2987 v9.CheckScriptFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2988 'vim9script', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2989 'command Echo echo# comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
2990 'Echo', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
2991 ], 'E1144:') |
23092
c713358da074
patch 8.2.2092: Vim9: unpredictable errors for script tests
Bram Moolenaar <Bram@vim.org>
parents:
23084
diff
changeset
|
2992 delcommand Echo |
23162
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
2993 |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
2994 var curdir = getcwd() |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
2995 v9.CheckScriptSuccess([ |
23162
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
2996 'command Echo cd " comment', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
2997 'Echo', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
2998 'delcommand Echo', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
2999 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3000 v9.CheckScriptSuccess([ |
23247
f2d05fb28e54
patch 8.2.2169: Vim9: test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
23237
diff
changeset
|
3001 'vim9script', |
23162
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3002 'command Echo cd # comment', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3003 'Echo', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3004 'delcommand Echo', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3005 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3006 v9.CheckScriptFailure([ |
23162
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3007 'vim9script', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3008 'command Echo cd " comment', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3009 'Echo', |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3010 ], 'E344:') |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3011 delcommand Echo |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3012 chdir(curdir) |
c923f1888a77
patch 8.2.2127: Vim9: executing user command from Vim9 script not tested
Bram Moolenaar <Bram@vim.org>
parents:
23152
diff
changeset
|
3013 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3014 v9.CheckScriptFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3015 'vim9script', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3016 'command Echo# comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3017 ], 'E182:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3018 v9.CheckScriptFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3019 'vim9script', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3020 'command Echo echo', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3021 'command Echo# comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3022 ], 'E182:') |
23092
c713358da074
patch 8.2.2092: Vim9: unpredictable errors for script tests
Bram Moolenaar <Bram@vim.org>
parents:
23084
diff
changeset
|
3023 delcommand Echo |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3024 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3025 v9.CheckScriptSuccess([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3026 'vim9script', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3027 'function # comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3028 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3029 v9.CheckScriptFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3030 'vim9script', |
21528
e0aa9b81f6a9
patch 8.2.1314: Vim9: rule for comment after :function is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21526
diff
changeset
|
3031 'function " comment', |
e0aa9b81f6a9
patch 8.2.1314: Vim9: rule for comment after :function is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21526
diff
changeset
|
3032 ], 'E129:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3033 v9.CheckScriptFailure([ |
21528
e0aa9b81f6a9
patch 8.2.1314: Vim9: rule for comment after :function is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21526
diff
changeset
|
3034 'vim9script', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3035 'function# comment', |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
3036 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3037 v9.CheckScriptSuccess([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3038 'vim9script', |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3039 'import "./vim9.vim" as v9', |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3040 'function v9.CheckScriptSuccess # comment', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3041 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3042 v9.CheckScriptFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3043 'vim9script', |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3044 'import "./vim9.vim" as v9', |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3045 'function v9.CheckScriptSuccess# comment', |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3046 ], 'E1048: Item not found in script: CheckScriptSuccess#') |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3047 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3048 v9.CheckScriptSuccess([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3049 'vim9script', |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
3050 'func g:DeleteMeA()', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3051 'endfunc', |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
3052 'delfunction g:DeleteMeA # comment', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3053 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3054 v9.CheckScriptFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3055 'vim9script', |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
3056 'func g:DeleteMeB()', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3057 'endfunc', |
20189
63cc54100ae4
patch 8.2.0650: Vim9: script function can be deleted
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
3058 'delfunction g:DeleteMeB# comment', |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3059 ], 'E488:') |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3060 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3061 v9.CheckScriptSuccess([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3062 'vim9script', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3063 'call execute("ls") # comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3064 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3065 v9.CheckScriptFailure([ |
20138
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3066 'vim9script', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3067 'call execute("ls")# comment', |
d0a9766167ab
patch 8.2.0624: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
3068 ], 'E488:') |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3069 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3070 v9.CheckScriptFailure([ |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3071 'def Test() " comment', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3072 'enddef', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3073 ], 'E488:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3074 v9.CheckScriptFailure([ |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3075 'vim9script', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3076 'def Test() " comment', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3077 'enddef', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3078 ], 'E488:') |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3079 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3080 v9.CheckScriptSuccess([ |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3081 'func Test() " comment', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3082 'endfunc', |
23092
c713358da074
patch 8.2.2092: Vim9: unpredictable errors for script tests
Bram Moolenaar <Bram@vim.org>
parents:
23084
diff
changeset
|
3083 'delfunc Test', |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3084 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3085 v9.CheckScriptSuccess([ |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3086 'vim9script', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3087 'func Test() " comment', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3088 'endfunc', |
21528
e0aa9b81f6a9
patch 8.2.1314: Vim9: rule for comment after :function is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21526
diff
changeset
|
3089 ]) |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3090 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3091 v9.CheckScriptSuccess([ |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3092 'def Test() # comment', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3093 'enddef', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3094 ]) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3095 v9.CheckScriptFailure([ |
21435
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3096 'func Test() # comment', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3097 'endfunc', |
8ec9e2b54ce7
patch 8.2.1268: Vim9: no error for using double quote comment
Bram Moolenaar <Bram@vim.org>
parents:
21413
diff
changeset
|
3098 ], 'E488:') |
24774
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3099 |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3100 var lines =<< trim END |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3101 vim9script |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3102 syn region Text |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3103 \ start='foo' |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3104 #\ comment |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3105 \ end='bar' |
24786
524120691c3d
patch 8.2.2931: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24774
diff
changeset
|
3106 syn region Text start='foo' |
524120691c3d
patch 8.2.2931: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24774
diff
changeset
|
3107 #\ comment |
524120691c3d
patch 8.2.2931: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24774
diff
changeset
|
3108 \ end='bar' |
24774
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3109 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3110 v9.CheckScriptSuccess(lines) |
24774
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3111 |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3112 lines =<< trim END |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3113 vim9script |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3114 syn region Text |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3115 \ start='foo' |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3116 "\ comment |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3117 \ end='bar' |
8bf9726097d8
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Bram Moolenaar <Bram@vim.org>
parents:
24699
diff
changeset
|
3118 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3119 v9.CheckScriptFailure(lines, 'E399:') |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3120 enddef |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3121 |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3122 def Test_vim9_comment_gui() |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3123 CheckCanRunGui |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3124 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3125 v9.CheckScriptFailure([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3126 'vim9script', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3127 'gui#comment' |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
3128 ], 'E1144:') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3129 v9.CheckScriptFailure([ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3130 'vim9script', |
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20111
diff
changeset
|
3131 'gui -f#comment' |
25654
ef38fc02faaa
patch 8.2.3363: when :edit reuses the current buffer the alternate file is set
Bram Moolenaar <Bram@vim.org>
parents:
25650
diff
changeset
|
3132 ], 'E194:') |
20059
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
3133 enddef |
de756b3f4dee
patch 8.2.0585: Vim9: # comment not recognized after :vim9script
Bram Moolenaar <Bram@vim.org>
parents:
20055
diff
changeset
|
3134 |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3135 def Test_vim9_comment_not_compiled() |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3136 au TabEnter *.vim g:entered = 1 |
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3137 au TabEnter *.x g:entered = 2 |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3138 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3139 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
|
3140 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
|
3141 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
|
3142 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3143 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
|
3144 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
|
3145 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3146 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
|
3147 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
|
3148 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
|
3149 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3150 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
|
3151 |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3152 au! TabEnter |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3153 unlet g:entered |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3154 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3155 v9.CheckScriptSuccess([ |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3156 'vim9script', |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3157 'g:var = 123', |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3158 'b:var = 456', |
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3159 'w:var = 777', |
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3160 't:var = 888', |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3161 '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
|
3162 ]) |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3163 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3164 v9.CheckScriptFailure([ |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3165 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3166 'let var = 123', |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3167 ], 'E1126: Cannot use :let in Vim9 script') |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3168 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3169 v9.CheckScriptFailure([ |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3170 'vim9script', |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3171 'var g:var = 123', |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3172 ], 'E1016: Cannot declare a global variable:') |
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3173 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3174 v9.CheckScriptFailure([ |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3175 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3176 'var b:var = 123', |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3177 ], 'E1016: Cannot declare a buffer variable:') |
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3178 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3179 v9.CheckScriptFailure([ |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3180 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3181 'var w:var = 123', |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3182 ], 'E1016: Cannot declare a window variable:') |
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3183 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3184 v9.CheckScriptFailure([ |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3185 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3186 'var t:var = 123', |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3187 ], 'E1016: Cannot declare a tab variable:') |
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3188 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3189 v9.CheckScriptFailure([ |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3190 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3191 'var v:version = 123', |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3192 ], 'E1016: Cannot declare a v: variable:') |
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3193 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3194 v9.CheckScriptFailure([ |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3195 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3196 'var $VARIABLE = "text"', |
20953
6b4b887a12f0
patch 8.2.1028: Vim9: no error for declaring buffer, window, etc. variable
Bram Moolenaar <Bram@vim.org>
parents:
20945
diff
changeset
|
3197 ], 'E1016: Cannot declare an environment variable:') |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3198 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3199 v9.CheckScriptFailure([ |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3200 'vim9script', |
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3201 'g:var = 123', |
20397
c225be44692a
patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Bram Moolenaar <Bram@vim.org>
parents:
20351
diff
changeset
|
3202 'unlet g:var# comment1', |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3203 ], 'E108:') |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3204 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3205 v9.CheckScriptFailure([ |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3206 'let g:var = 123', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3207 'unlet g:var # something', |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
3208 ], 'E488:') |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3209 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3210 v9.CheckScriptSuccess([ |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3211 'vim9script', |
20397
c225be44692a
patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Bram Moolenaar <Bram@vim.org>
parents:
20351
diff
changeset
|
3212 'if 1 # comment2', |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3213 ' echo "yes"', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3214 'elseif 2 #comment', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3215 ' echo "no"', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3216 'endif', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3217 ]) |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3218 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3219 v9.CheckScriptFailure([ |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3220 'vim9script', |
20397
c225be44692a
patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Bram Moolenaar <Bram@vim.org>
parents:
20351
diff
changeset
|
3221 'if 1# comment3', |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3222 ' echo "yes"', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3223 'endif', |
24958
21ec48d542a8
patch 8.2.3016: confusing error when expression is followed by comma
Bram Moolenaar <Bram@vim.org>
parents:
24934
diff
changeset
|
3224 ], 'E488:') |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3225 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3226 v9.CheckScriptFailure([ |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3227 'vim9script', |
20397
c225be44692a
patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Bram Moolenaar <Bram@vim.org>
parents:
20351
diff
changeset
|
3228 'if 0 # comment4', |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3229 ' echo "yes"', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3230 'elseif 2#comment', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3231 ' echo "no"', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3232 'endif', |
24958
21ec48d542a8
patch 8.2.3016: confusing error when expression is followed by comma
Bram Moolenaar <Bram@vim.org>
parents:
24934
diff
changeset
|
3233 ], 'E488:') |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3234 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3235 v9.CheckScriptSuccess([ |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3236 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3237 'var v = 1 # comment5', |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3238 ]) |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3239 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3240 v9.CheckScriptFailure([ |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3241 'vim9script', |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3242 'var v = 1# comment6', |
24958
21ec48d542a8
patch 8.2.3016: confusing error when expression is followed by comma
Bram Moolenaar <Bram@vim.org>
parents:
24934
diff
changeset
|
3243 ], 'E488:') |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3244 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3245 v9.CheckScriptSuccess([ |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3246 'vim9script', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3247 'new' |
22147
d55008685870
patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3248 'setline(1, ["# define pat", "last"])', |
20982
bb49b5090a9c
patch 8.2.1042: Vim9: cannot put an operator on the next line
Bram Moolenaar <Bram@vim.org>
parents:
20953
diff
changeset
|
3249 ':$', |
20111
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3250 'dsearch /pat/ #comment', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3251 'bwipe!', |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3252 ]) |
f40231487a49
patch 8.2.0611: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
3253 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3254 v9.CheckScriptFailure([ |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3255 'vim9script', |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3256 'new' |
22147
d55008685870
patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3257 'setline(1, ["# define pat", "last"])', |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3258 ':$', |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3259 'dsearch /pat/#comment', |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3260 'bwipe!', |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3261 ], 'E488:') |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3262 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3263 v9.CheckScriptFailure([ |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3264 'vim9script', |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3265 'func! SomeFunc()', |
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
3266 ], 'E477:') |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3267 enddef |
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20061
diff
changeset
|
3268 |
20351
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3269 def Test_finish() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3270 var lines =<< trim END |
20351
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3271 vim9script |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3272 g:res = 'one' |
20351
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3273 if v:false | finish | endif |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3274 g:res = 'two' |
20351
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3275 finish |
20945
0653b9b72091
patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents:
20921
diff
changeset
|
3276 g:res = 'three' |
20351
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3277 END |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3278 writefile(lines, 'Xfinished') |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3279 source Xfinished |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3280 assert_equal('two', g:res) |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3281 |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3282 unlet g:res |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3283 delete('Xfinished') |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3284 enddef |
680296770464
patch 8.2.0731: Vim9: parsing declarations continues after :finish
Bram Moolenaar <Bram@vim.org>
parents:
20349
diff
changeset
|
3285 |
20399
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3286 def Test_forward_declaration() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3287 var lines =<< trim END |
20399
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3288 vim9script |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3289 def GetValue(): string |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3290 return theVal |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3291 enddef |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3292 var theVal = 'something' |
20528
489cb75c76b6
patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Bram Moolenaar <Bram@vim.org>
parents:
20504
diff
changeset
|
3293 g:initVal = GetValue() |
20399
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3294 theVal = 'else' |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3295 g:laterVal = GetValue() |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3296 END |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3297 writefile(lines, 'Xforward') |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3298 source Xforward |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3299 assert_equal('something', g:initVal) |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3300 assert_equal('else', g:laterVal) |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3301 |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3302 unlet g:initVal |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3303 unlet g:laterVal |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3304 delete('Xforward') |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3305 enddef |
d1a54d2bd145
patch 8.2.0754: Vim9: No test for forward declaration
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
3306 |
27690
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3307 def Test_declare_script_var_in_func() |
24279
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3308 var lines =<< trim END |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3309 vim9script |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3310 func Declare() |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3311 let s:local = 123 |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3312 endfunc |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3313 Declare() |
27690
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3314 END |
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3315 v9.CheckScriptFailure(lines, 'E1269:') |
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3316 enddef |
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3317 |
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3318 def Test_lock_script_var() |
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3319 var lines =<< trim END |
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3320 vim9script |
fae9567b8024
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Bram Moolenaar <Bram@vim.org>
parents:
27669
diff
changeset
|
3321 var local = 123 |
24279
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3322 assert_equal(123, local) |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3323 |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3324 var error: string |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3325 try |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3326 local = 'asdf' |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3327 catch |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3328 error = v:exception |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3329 endtry |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3330 assert_match('E1012: Type mismatch; expected number but got string', error) |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3331 |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3332 lockvar local |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3333 try |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3334 local = 999 |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3335 catch |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3336 error = v:exception |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3337 endtry |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3338 assert_match('E741: Value is locked: local', error) |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3339 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3340 v9.CheckScriptSuccess(lines) |
24279
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3341 enddef |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3342 |
e3dbf2e58c6a
patch 8.2.2680: Vim9: problem defining a script variable from legacy function
Bram Moolenaar <Bram@vim.org>
parents:
24234
diff
changeset
|
3343 |
21801
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3344 func Test_vim9script_not_global() |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3345 " check that items defined in Vim9 script are script-local, not global |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3346 let vim9lines =<< trim END |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3347 vim9script |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3348 var name = 'local' |
21801
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3349 func TheFunc() |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3350 echo 'local' |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3351 endfunc |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3352 def DefFunc() |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3353 echo 'local' |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3354 enddef |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3355 END |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3356 call writefile(vim9lines, 'Xvim9script.vim') |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3357 source Xvim9script.vim |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3358 try |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3359 echo g:var |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3360 assert_report('did not fail') |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3361 catch /E121:/ |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3362 " caught |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3363 endtry |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3364 try |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3365 call TheFunc() |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3366 assert_report('did not fail') |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3367 catch /E117:/ |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3368 " caught |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3369 endtry |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3370 try |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3371 call DefFunc() |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3372 assert_report('did not fail') |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3373 catch /E117:/ |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3374 " caught |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3375 endtry |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3376 |
21987
c33cec63cf53
patch 8.2.1543: Vim9: test with invalid SID is skipped in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21985
diff
changeset
|
3377 call delete('Xvim9script.vim') |
21801
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3378 endfunc |
1344d45ca6f2
patch 8.2.1450: Vim9: no check that script-local items don't become global
Bram Moolenaar <Bram@vim.org>
parents:
21791
diff
changeset
|
3379 |
21150
951aad18b1af
patch 8.2.1126: Vim9: using :copen causes an error
Bram Moolenaar <Bram@vim.org>
parents:
21146
diff
changeset
|
3380 def Test_vim9_copen() |
951aad18b1af
patch 8.2.1126: Vim9: using :copen causes an error
Bram Moolenaar <Bram@vim.org>
parents:
21146
diff
changeset
|
3381 # this was giving an error for setting w:quickfix_title |
951aad18b1af
patch 8.2.1126: Vim9: using :copen causes an error
Bram Moolenaar <Bram@vim.org>
parents:
21146
diff
changeset
|
3382 copen |
951aad18b1af
patch 8.2.1126: Vim9: using :copen causes an error
Bram Moolenaar <Bram@vim.org>
parents:
21146
diff
changeset
|
3383 quit |
951aad18b1af
patch 8.2.1126: Vim9: using :copen causes an error
Bram Moolenaar <Bram@vim.org>
parents:
21146
diff
changeset
|
3384 enddef |
951aad18b1af
patch 8.2.1126: Vim9: using :copen causes an error
Bram Moolenaar <Bram@vim.org>
parents:
21146
diff
changeset
|
3385 |
21907
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3386 def Test_script_var_in_autocmd() |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3387 # using a script variable from an autocommand, defined in a :def function in a |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3388 # legacy Vim script, cannot check the variable type. |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3389 var lines =<< trim END |
21907
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3390 let s:counter = 1 |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3391 def s:Func() |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3392 au! CursorHold |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3393 au CursorHold * s:counter += 1 |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3394 enddef |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3395 call s:Func() |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3396 doau CursorHold |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3397 call assert_equal(2, s:counter) |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3398 au! CursorHold |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3399 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3400 v9.CheckScriptSuccess(lines) |
21907
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3401 enddef |
f4e21796f47d
patch 8.2.1503: Vim9: error for autocmd defined in :def in legacy script
Bram Moolenaar <Bram@vim.org>
parents:
21905
diff
changeset
|
3402 |
25260
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3403 def Test_error_in_autoload_script() |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3404 var save_rtp = &rtp |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3405 var dir = getcwd() .. '/Xruntime' |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3406 &rtp = dir |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3407 mkdir(dir .. '/autoload', 'p') |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3408 |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3409 var lines =<< trim END |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3410 vim9script noclear |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
3411 export def Autoloaded() |
25260
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3412 enddef |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3413 def Broken() |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3414 var x: any = '' |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3415 eval x != 0 |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3416 enddef |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3417 Broken() |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3418 END |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3419 writefile(lines, dir .. '/autoload/script.vim') |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3420 |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3421 lines =<< trim END |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3422 vim9script |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3423 def CallAutoloaded() |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
3424 script#Autoloaded() |
25260
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3425 enddef |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3426 |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3427 function Legacy() |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3428 try |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3429 call s:CallAutoloaded() |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3430 catch |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3431 call assert_match('E1030: Using a String as a Number', v:exception) |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3432 endtry |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3433 endfunction |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3434 |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3435 Legacy() |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3436 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3437 v9.CheckScriptSuccess(lines) |
25260
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3438 |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3439 &rtp = save_rtp |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3440 delete(dir, 'rf') |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3441 enddef |
a60895011da9
patch 8.2.3166: Vim9: nested autoload call error overruled by "Unknown error"
Bram Moolenaar <Bram@vim.org>
parents:
25230
diff
changeset
|
3442 |
21979
a98211c3e14e
patch 8.2.1539: using invalid script ID causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
21957
diff
changeset
|
3443 def Test_invalid_sid() |
a98211c3e14e
patch 8.2.1539: using invalid script ID causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
21957
diff
changeset
|
3444 assert_fails('func <SNR>1234_func', 'E123:') |
21987
c33cec63cf53
patch 8.2.1543: Vim9: test with invalid SID is skipped in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21985
diff
changeset
|
3445 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3446 if g:RunVim([], ['wq! Xdidit'], '+"func <SNR>1_func"') |
22147
d55008685870
patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3447 assert_equal([], readfile('Xdidit')) |
21979
a98211c3e14e
patch 8.2.1539: using invalid script ID causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
21957
diff
changeset
|
3448 endif |
a98211c3e14e
patch 8.2.1539: using invalid script ID causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
21957
diff
changeset
|
3449 delete('Xdidit') |
a98211c3e14e
patch 8.2.1539: using invalid script ID causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
21957
diff
changeset
|
3450 enddef |
a98211c3e14e
patch 8.2.1539: using invalid script ID causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
21957
diff
changeset
|
3451 |
23152
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3452 def Test_restoring_cpo() |
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3453 writefile(['vim9script', 'set nocp'], 'Xsourced') |
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3454 writefile(['call writefile(["done"], "Xdone")', 'quit!'], 'Xclose') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3455 if g:RunVim([], [], '-u NONE +"set cpo+=a" -S Xsourced -S Xclose') |
23152
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3456 assert_equal(['done'], readfile('Xdone')) |
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3457 endif |
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3458 delete('Xsourced') |
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3459 delete('Xclose') |
23247
f2d05fb28e54
patch 8.2.2169: Vim9: test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
23237
diff
changeset
|
3460 delete('Xdone') |
23886
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3461 |
26745
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3462 writefile(['vim9script', 'g:cpoval = &cpo'], 'XanotherScript') |
23886
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3463 set cpo=aABceFsMny> |
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3464 edit XanotherScript |
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3465 so % |
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3466 assert_equal('aABceFsMny>', &cpo) |
26745
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3467 assert_equal('aABceFs', g:cpoval) |
23886
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3468 :1del |
26745
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3469 setline(1, 'let g:cpoval = &cpo') |
23886
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3470 w |
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3471 so % |
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3472 assert_equal('aABceFsMny>', &cpo) |
26745
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3473 assert_equal('aABceFsMny>', g:cpoval) |
23886
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3474 |
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3475 delete('XanotherScript') |
eef0cffbdb94
patch 8.2.2485: when sourcing a script again the script version isn't reset
Bram Moolenaar <Bram@vim.org>
parents:
23884
diff
changeset
|
3476 set cpo&vim |
26745
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3477 unlet g:cpoval |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3478 |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3479 if has('unix') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3480 # 'cpo' is not restored in main vimrc |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3481 var save_HOME = $HOME |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3482 $HOME = getcwd() .. '/Xhome' |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3483 mkdir('Xhome') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3484 var lines =<< trim END |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3485 vim9script |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3486 writefile(['before: ' .. &cpo], 'Xresult') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3487 set cpo+=M |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3488 writefile(['after: ' .. &cpo], 'Xresult', 'a') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3489 END |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3490 writefile(lines, 'Xhome/.vimrc') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3491 |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3492 lines =<< trim END |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3493 call writefile(['later: ' .. &cpo], 'Xresult', 'a') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3494 END |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3495 writefile(lines, 'Xlegacy') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3496 |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3497 lines =<< trim END |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3498 vim9script |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3499 call writefile(['vim9: ' .. &cpo], 'Xresult', 'a') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3500 qa |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3501 END |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3502 writefile(lines, 'Xvim9') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3503 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3504 var cmd = g:GetVimCommand() .. " -S Xlegacy -S Xvim9" |
26745
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3505 cmd = substitute(cmd, '-u NONE', '', '') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3506 exe "silent !" .. cmd |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3507 |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3508 assert_equal([ |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3509 'before: aABceFs', |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3510 'after: aABceFsM', |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3511 'later: aABceFsM', |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3512 'vim9: aABceFs'], readfile('Xresult')) |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3513 |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3514 $HOME = save_HOME |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3515 delete('Xhome', 'rf') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3516 delete('Xlegacy') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3517 delete('Xvim9') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3518 delete('Xresult') |
dcd1c244e332
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
26737
diff
changeset
|
3519 endif |
23152
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3520 enddef |
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3521 |
24081
7d28bac98927
patch 8.2.2582: Vim9: screendump test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
24079
diff
changeset
|
3522 " Use :function so we can use Check commands |
7d28bac98927
patch 8.2.2582: Vim9: screendump test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
24079
diff
changeset
|
3523 func Test_no_redraw_when_restoring_cpo() |
24079
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3524 CheckScreendump |
24081
7d28bac98927
patch 8.2.2582: Vim9: screendump test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
24079
diff
changeset
|
3525 CheckFeature timers |
27950
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3526 call Run_test_no_redraw_when_restoring_cpo() |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3527 endfunc |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3528 |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3529 def Run_test_no_redraw_when_restoring_cpo() |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3530 var lines =<< trim END |
24079
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3531 vim9script |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
3532 export def Func() |
24079
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3533 enddef |
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3534 END |
27950
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3535 mkdir('Xdir/autoload', 'p') |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3536 writefile(lines, 'Xdir/autoload/script.vim') |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3537 |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3538 lines =<< trim END |
24079
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3539 vim9script |
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3540 set cpo+=M |
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3541 exe 'set rtp^=' .. getcwd() .. '/Xdir' |
27472
55613f0d59bc
patch 8.2.4264: Vim9: can use old style autoload function name
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
3542 au CmdlineEnter : ++once timer_start(0, (_) => script#Func()) |
24079
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3543 setline(1, 'some text') |
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3544 END |
27950
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3545 writefile(lines, 'XTest_redraw_cpo') |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3546 var buf = g:RunVimInTerminal('-S XTest_redraw_cpo', {'rows': 6}) |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3547 term_sendkeys(buf, "V:") |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3548 g:VerifyScreenDump(buf, 'Test_vim9_no_redraw', {}) |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3549 |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3550 # clean up |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3551 term_sendkeys(buf, "\<Esc>u") |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3552 g:StopVimInTerminal(buf) |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3553 delete('XTest_redraw_cpo') |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3554 delete('Xdir', 'rf') |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3555 enddef |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3556 |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3557 func Test_reject_declaration() |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3558 CheckScreendump |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3559 call Run_test_reject_declaration() |
24081
7d28bac98927
patch 8.2.2582: Vim9: screendump test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
24079
diff
changeset
|
3560 endfunc |
24079
a9ff8368d35f
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents:
24077
diff
changeset
|
3561 |
27950
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3562 def Run_test_reject_declaration() |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3563 var buf = g:RunVimInTerminal('', {'rows': 6}) |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3564 term_sendkeys(buf, ":vim9cmd var x: number\<CR>") |
27966
80f398bfc19f
patch 8.2.4508: Vim9: cannot assign to a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27956
diff
changeset
|
3565 g:VerifyScreenDump(buf, 'Test_vim9_reject_declaration_1', {}) |
80f398bfc19f
patch 8.2.4508: Vim9: cannot assign to a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27956
diff
changeset
|
3566 term_sendkeys(buf, ":\<CR>") |
80f398bfc19f
patch 8.2.4508: Vim9: cannot assign to a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27956
diff
changeset
|
3567 term_sendkeys(buf, ":vim9cmd g:foo = 123 | echo g:foo\<CR>") |
80f398bfc19f
patch 8.2.4508: Vim9: cannot assign to a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27956
diff
changeset
|
3568 g:VerifyScreenDump(buf, 'Test_vim9_reject_declaration_2', {}) |
27950
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3569 |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3570 # clean up |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3571 g:StopVimInTerminal(buf) |
aacc98a38cf3
patch 8.2.4500: Vim9: can declare a global variable on the command line
Bram Moolenaar <Bram@vim.org>
parents:
27948
diff
changeset
|
3572 enddef |
23152
1c94e4c9db00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Bram Moolenaar <Bram@vim.org>
parents:
23106
diff
changeset
|
3573 |
27970
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3574 def Test_minimal_command_name_length() |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3575 var names = [ |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3576 'cons', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3577 'brea', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3578 'cat', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3579 'catc', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3580 'con', |
27978
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3581 'cont', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3582 'conti', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3583 'contin', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3584 'continu', |
27970
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3585 'el', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3586 'els', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3587 'elsei', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3588 'endfo', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3589 'en', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3590 'end', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3591 'endi', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3592 'endw', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3593 'endt', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3594 'endtr', |
27978
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3595 'exp', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3596 'expo', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3597 'expor', |
27970
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3598 'fina', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3599 'finall', |
27988
0c84b198c678
patch 8.2.4519: Vim9: Can still use ":fini" and ":finis" for ":finish"
Bram Moolenaar <Bram@vim.org>
parents:
27978
diff
changeset
|
3600 'fini', |
0c84b198c678
patch 8.2.4519: Vim9: Can still use ":fini" and ":finis" for ":finish"
Bram Moolenaar <Bram@vim.org>
parents:
27978
diff
changeset
|
3601 'finis', |
27978
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3602 'imp', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3603 'impo', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3604 'impor', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3605 'retu', |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3606 'retur', |
27970
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3607 'th', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3608 'thr', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3609 'thro', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3610 'wh', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3611 'whi', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3612 'whil', |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3613 ] |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3614 for name in names |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3615 v9.CheckDefAndScriptFailure([name .. ' '], 'E1065:') |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3616 endfor |
27978
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3617 |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3618 var lines =<< trim END |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3619 vim9script |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3620 def SomeFunc() |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3621 endd |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3622 END |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3623 v9.CheckScriptFailure(lines, 'E1065:') |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3624 lines =<< trim END |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3625 vim9script |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3626 def SomeFunc() |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3627 endde |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3628 END |
442ca2007bec
patch 8.2.4514: Vim9: some flow commands can be shortened
Bram Moolenaar <Bram@vim.org>
parents:
27970
diff
changeset
|
3629 v9.CheckScriptFailure(lines, 'E1065:') |
27970
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3630 enddef |
212c5894b8b1
patch 8.2.4510: Vim9: shortening commands leads to confusing script
Bram Moolenaar <Bram@vim.org>
parents:
27966
diff
changeset
|
3631 |
22250
dd42235ed626
patch 8.2.1674: Vim9: internal error when using variable that was not set
Bram Moolenaar <Bram@vim.org>
parents:
22202
diff
changeset
|
3632 def Test_unset_any_variable() |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3633 var lines =<< trim END |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3634 var name: any |
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3635 assert_equal(0, name) |
22250
dd42235ed626
patch 8.2.1674: Vim9: internal error when using variable that was not set
Bram Moolenaar <Bram@vim.org>
parents:
22202
diff
changeset
|
3636 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3637 v9.CheckDefAndScriptSuccess(lines) |
22250
dd42235ed626
patch 8.2.1674: Vim9: internal error when using variable that was not set
Bram Moolenaar <Bram@vim.org>
parents:
22202
diff
changeset
|
3638 enddef |
dd42235ed626
patch 8.2.1674: Vim9: internal error when using variable that was not set
Bram Moolenaar <Bram@vim.org>
parents:
22202
diff
changeset
|
3639 |
22387
36f13f35bd78
patch 8.2.1742: test still fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22383
diff
changeset
|
3640 func Test_define_func_at_command_line() |
22383
82d92f6c756c
patch 8.2.1740: test fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22381
diff
changeset
|
3641 CheckRunVimInTerminal |
82d92f6c756c
patch 8.2.1740: test fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22381
diff
changeset
|
3642 |
22387
36f13f35bd78
patch 8.2.1742: test still fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22383
diff
changeset
|
3643 " call indirectly to avoid compilation error for missing functions |
36f13f35bd78
patch 8.2.1742: test still fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22383
diff
changeset
|
3644 call Run_Test_define_func_at_command_line() |
36f13f35bd78
patch 8.2.1742: test still fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22383
diff
changeset
|
3645 endfunc |
36f13f35bd78
patch 8.2.1742: test still fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22383
diff
changeset
|
3646 |
36f13f35bd78
patch 8.2.1742: test still fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents:
22383
diff
changeset
|
3647 def Run_Test_define_func_at_command_line() |
22381
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3648 # run in a separate Vim instance to avoid the script context |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
3649 var lines =<< trim END |
22381
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3650 func CheckAndQuit() |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3651 call assert_fails('call Afunc()', 'E117: Unknown function: Bfunc') |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3652 call writefile(['errors: ' .. string(v:errors)], 'Xdidcmd') |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3653 endfunc |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3654 END |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3655 writefile([''], 'Xdidcmd') |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3656 writefile(lines, 'XcallFunc') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3657 var buf = g:RunVimInTerminal('-S XcallFunc', {rows: 6}) |
22381
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3658 # define Afunc() on the command line |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3659 term_sendkeys(buf, ":def Afunc()\<CR>Bfunc()\<CR>enddef\<CR>") |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3660 term_sendkeys(buf, ":call CheckAndQuit()\<CR>") |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3661 g:WaitForAssert(() => assert_equal(['errors: []'], readfile('Xdidcmd'))) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3662 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3663 call g:StopVimInTerminal(buf) |
22381
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3664 delete('XcallFunc') |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3665 delete('Xdidcmd') |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3666 enddef |
6fe9536694ff
patch 8.2.1739: Vim9: crash when compiling a manually defined function
Bram Moolenaar <Bram@vim.org>
parents:
22351
diff
changeset
|
3667 |
22551
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3668 def Test_script_var_scope() |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3669 var lines =<< trim END |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3670 vim9script |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3671 if true |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3672 if true |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3673 var one = 'one' |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3674 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3675 endif |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3676 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3677 endif |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3678 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3679 v9.CheckScriptFailure(lines, 'E121:', 7) |
22551
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3680 |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3681 lines =<< trim END |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3682 vim9script |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3683 if true |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3684 if false |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3685 var one = 'one' |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3686 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3687 else |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3688 var one = 'one' |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3689 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3690 endif |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3691 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3692 endif |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3693 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3694 v9.CheckScriptFailure(lines, 'E121:', 10) |
22551
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3695 |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3696 lines =<< trim END |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3697 vim9script |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3698 while true |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3699 var one = 'one' |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3700 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3701 break |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3702 endwhile |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3703 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3704 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3705 v9.CheckScriptFailure(lines, 'E121:', 7) |
22551
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3706 |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3707 lines =<< trim END |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3708 vim9script |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3709 for i in range(1) |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3710 var one = 'one' |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3711 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3712 endfor |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3713 echo one |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3714 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3715 v9.CheckScriptFailure(lines, 'E121:', 6) |
22555
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3716 |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3717 lines =<< trim END |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3718 vim9script |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3719 { |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3720 var one = 'one' |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3721 assert_equal('one', one) |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3722 } |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3723 assert_false(exists('one')) |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3724 assert_false(exists('s:one')) |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3725 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3726 v9.CheckScriptSuccess(lines) |
22555
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3727 |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3728 lines =<< trim END |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3729 vim9script |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3730 { |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3731 var one = 'one' |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3732 echo one |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3733 } |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3734 echo one |
7d25264c246c
patch 8.2.1826: Vim9: cannot use a {} block at script level
Bram Moolenaar <Bram@vim.org>
parents:
22551
diff
changeset
|
3735 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3736 v9.CheckScriptFailure(lines, 'E121:', 6) |
22551
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3737 enddef |
86a115a80262
patch 8.2.1824: Vim9: variables at the script level escape their scope
Bram Moolenaar <Bram@vim.org>
parents:
22529
diff
changeset
|
3738 |
22621
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3739 def Test_catch_exception_in_callback() |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3740 var lines =<< trim END |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3741 vim9script |
24400
62e978382fa0
patch 8.2.2740: Vim9: lambda with varargs doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
24398
diff
changeset
|
3742 def Callback(...l: list<any>) |
22621
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3743 try |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3744 var x: string |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3745 var y: string |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3746 # this error should be caught with CHECKLEN |
26372
f5727e2603f0
patch 8.2.3717: Vim9: error for constant list size is only given at runtime
Bram Moolenaar <Bram@vim.org>
parents:
26238
diff
changeset
|
3747 var sl = [''] |
f5727e2603f0
patch 8.2.3717: Vim9: error for constant list size is only given at runtime
Bram Moolenaar <Bram@vim.org>
parents:
26238
diff
changeset
|
3748 [x, y] = sl |
22621
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3749 catch |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3750 g:caught = 'yes' |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3751 endtry |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3752 enddef |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
3753 popup_menu('popup', {callback: Callback}) |
22621
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3754 feedkeys("\r", 'xt') |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3755 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3756 v9.CheckScriptSuccess(lines) |
22621
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3757 |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3758 unlet g:caught |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3759 enddef |
576a69fc0066
patch 8.2.1859: Vim9: crash in unpack assignment
Bram Moolenaar <Bram@vim.org>
parents:
22612
diff
changeset
|
3760 |
22810
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3761 def Test_no_unknown_error_after_error() |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3762 if !has('unix') || !has('job') |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3763 throw 'Skipped: not unix of missing +job feature' |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3764 endif |
25846
8b0dad68e98a
patch 8.2.3457: MS-Windows Vim9: test executed and fails
Bram Moolenaar <Bram@vim.org>
parents:
25755
diff
changeset
|
3765 # FIXME: this check should not be needed |
8b0dad68e98a
patch 8.2.3457: MS-Windows Vim9: test executed and fails
Bram Moolenaar <Bram@vim.org>
parents:
25755
diff
changeset
|
3766 if has('win32') |
8b0dad68e98a
patch 8.2.3457: MS-Windows Vim9: test executed and fails
Bram Moolenaar <Bram@vim.org>
parents:
25755
diff
changeset
|
3767 throw 'Skipped: does not work on MS-Windows' |
8b0dad68e98a
patch 8.2.3457: MS-Windows Vim9: test executed and fails
Bram Moolenaar <Bram@vim.org>
parents:
25755
diff
changeset
|
3768 endif |
22810
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3769 var lines =<< trim END |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3770 vim9script |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3771 var source: list<number> |
24400
62e978382fa0
patch 8.2.2740: Vim9: lambda with varargs doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
24398
diff
changeset
|
3772 def Out_cb(...l: list<any>) |
22810
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3773 eval [][0] |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3774 enddef |
24400
62e978382fa0
patch 8.2.2740: Vim9: lambda with varargs doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
24398
diff
changeset
|
3775 def Exit_cb(...l: list<any>) |
22810
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3776 sleep 1m |
28676
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3777 g:did_call_exit_cb = true |
22810
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3778 source += l |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3779 enddef |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23068
diff
changeset
|
3780 var myjob = job_start('echo burp', {out_cb: Out_cb, exit_cb: Exit_cb, mode: 'raw'}) |
23268
65fd662b434d
patch 8.2.2180: Vim9: test for error after error is flaky
Bram Moolenaar <Bram@vim.org>
parents:
23252
diff
changeset
|
3781 while job_status(myjob) == 'run' |
65fd662b434d
patch 8.2.2180: Vim9: test for error after error is flaky
Bram Moolenaar <Bram@vim.org>
parents:
23252
diff
changeset
|
3782 sleep 10m |
65fd662b434d
patch 8.2.2180: Vim9: test for error after error is flaky
Bram Moolenaar <Bram@vim.org>
parents:
23252
diff
changeset
|
3783 endwhile |
23790
e2ebd45d4db0
patch 8.2.2436: Vim9 script test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
23723
diff
changeset
|
3784 # wait for Exit_cb() to be called |
28676
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3785 for x in range(100) |
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3786 if exists('g:did_call_exit_cb') |
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3787 unlet g:did_call_exit_cb |
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3788 break |
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3789 endif |
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3790 sleep 10m |
89ff3a0fff82
patch 8.2.4862: Vim9: test may fail when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents:
28646
diff
changeset
|
3791 endfor |
22810
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3792 END |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3793 writefile(lines, 'Xdef') |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3794 assert_fails('so Xdef', ['E684:', 'E1012:']) |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3795 delete('Xdef') |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3796 enddef |
2d05dd71aac3
patch 8.2.1953: Vim9: extra "unknown" error after other error
Bram Moolenaar <Bram@vim.org>
parents:
22732
diff
changeset
|
3797 |
23056
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3798 def InvokeNormal() |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3799 exe "norm! :m+1\r" |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3800 enddef |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3801 |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3802 def Test_invoke_normal_in_visual_mode() |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3803 xnoremap <F3> <Cmd>call <SID>InvokeNormal()<CR> |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3804 new |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3805 setline(1, ['aaa', 'bbb']) |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3806 feedkeys("V\<F3>", 'xt') |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3807 assert_equal(['bbb', 'aaa'], getline(1, 2)) |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3808 xunmap <F3> |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3809 enddef |
57b6427c18e4
patch 8.2.2074: Vim9: using :normal from Vim9 script can't handle range
Bram Moolenaar <Bram@vim.org>
parents:
23054
diff
changeset
|
3810 |
23185
055fa9db6f39
patch 8.2.2138: Vim9: "exit_cb" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
23183
diff
changeset
|
3811 def Test_white_space_after_command() |
055fa9db6f39
patch 8.2.2138: Vim9: "exit_cb" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
23183
diff
changeset
|
3812 var lines =<< trim END |
055fa9db6f39
patch 8.2.2138: Vim9: "exit_cb" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
23183
diff
changeset
|
3813 exit_cb: Func}) |
055fa9db6f39
patch 8.2.2138: Vim9: "exit_cb" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
23183
diff
changeset
|
3814 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3815 v9.CheckDefAndScriptFailure(lines, 'E1144:', 1) |
23342
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
3816 |
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
3817 lines =<< trim END |
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
3818 e# |
13572a262b15
patch 8.2.2214: ":e#" does not give a warning for missing white space
Bram Moolenaar <Bram@vim.org>
parents:
23330
diff
changeset
|
3819 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3820 v9.CheckDefAndScriptFailure(lines, 'E1144:', 1) |
23185
055fa9db6f39
patch 8.2.2138: Vim9: "exit_cb" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
23183
diff
changeset
|
3821 enddef |
055fa9db6f39
patch 8.2.2138: Vim9: "exit_cb" causes Vim to exit
Bram Moolenaar <Bram@vim.org>
parents:
23183
diff
changeset
|
3822 |
23330
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3823 def Test_script_var_gone_when_sourced_twice() |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3824 var lines =<< trim END |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3825 vim9script |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3826 if exists('g:guard') |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3827 finish |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3828 endif |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3829 g:guard = 1 |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3830 var name = 'thename' |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3831 def g:GetName(): string |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3832 return name |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3833 enddef |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3834 def g:SetName(arg: string) |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3835 name = arg |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3836 enddef |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3837 END |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3838 writefile(lines, 'XscriptTwice.vim') |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3839 so XscriptTwice.vim |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3840 assert_equal('thename', g:GetName()) |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3841 g:SetName('newname') |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3842 assert_equal('newname', g:GetName()) |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3843 so XscriptTwice.vim |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3844 assert_fails('call g:GetName()', 'E1149:') |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3845 assert_fails('call g:SetName("x")', 'E1149:') |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3846 |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3847 delfunc g:GetName |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3848 delfunc g:SetName |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3849 delete('XscriptTwice.vim') |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3850 unlet g:guard |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3851 enddef |
e8eb4fd44902
patch 8.2.2208: Vim9: after reloading a script variable index may be invalid
Bram Moolenaar <Bram@vim.org>
parents:
23268
diff
changeset
|
3852 |
23978
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3853 def Test_unsupported_commands() |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3854 var lines =<< trim END |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3855 ka |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3856 END |
27956
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3857 v9.CheckDefAndScriptFailure(lines, ['E476:', 'E492:']) |
23978
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3858 |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3859 lines =<< trim END |
23980
bee8c78c0c6a
patch 8.2.2532: Vim9: confusing error if :k is used with a range
Bram Moolenaar <Bram@vim.org>
parents:
23978
diff
changeset
|
3860 :1ka |
bee8c78c0c6a
patch 8.2.2532: Vim9: confusing error if :k is used with a range
Bram Moolenaar <Bram@vim.org>
parents:
23978
diff
changeset
|
3861 END |
27956
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3862 v9.CheckDefAndScriptFailure(lines, ['E476:', 'E492:']) |
23980
bee8c78c0c6a
patch 8.2.2532: Vim9: confusing error if :k is used with a range
Bram Moolenaar <Bram@vim.org>
parents:
23978
diff
changeset
|
3863 |
bee8c78c0c6a
patch 8.2.2532: Vim9: confusing error if :k is used with a range
Bram Moolenaar <Bram@vim.org>
parents:
23978
diff
changeset
|
3864 lines =<< trim END |
28570
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3865 :k a |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3866 END |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3867 v9.CheckDefAndScriptFailure(lines, 'E1100:') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3868 |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3869 lines =<< trim END |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3870 :1k a |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3871 END |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3872 v9.CheckDefAndScriptFailure(lines, 'E481:') |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3873 |
35e24d9de858
patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents:
28305
diff
changeset
|
3874 lines =<< trim END |
23978
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3875 t |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3876 END |
27956
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3877 v9.CheckDefAndScriptFailure(lines, 'E1100:') |
23978
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3878 |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3879 lines =<< trim END |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3880 x |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3881 END |
27956
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3882 v9.CheckDefAndScriptFailure(lines, 'E1100:') |
23978
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3883 |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3884 lines =<< trim END |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3885 xit |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3886 END |
27956
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3887 v9.CheckDefAndScriptFailure(lines, 'E1100:') |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3888 |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3889 lines =<< trim END |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3890 Print |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3891 END |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3892 v9.CheckDefAndScriptFailure(lines, ['E476: Invalid command: Print', 'E492: Not an editor command: Print']) |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3893 |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3894 lines =<< trim END |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3895 mode 4 |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3896 END |
2485bf68de34
patch 8.2.4503: Vim9: there is no point in supporting :Print and :mode
Bram Moolenaar <Bram@vim.org>
parents:
27950
diff
changeset
|
3897 v9.CheckDefAndScriptFailure(lines, ['E476: Invalid command: mode 4', 'E492: Not an editor command: mode 4']) |
23978
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3898 enddef |
54b2aa1f0d42
patch 8.2.2531: Vim9: the :k command is obscure
Bram Moolenaar <Bram@vim.org>
parents:
23974
diff
changeset
|
3899 |
24471
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3900 def Test_mapping_line_number() |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3901 var lines =<< trim END |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3902 vim9script |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3903 def g:FuncA() |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3904 # Some comment |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3905 FuncB(0) |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3906 enddef |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3907 # Some comment |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3908 def FuncB( |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3909 # Some comment |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3910 n: number |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3911 ) |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3912 exe 'nno ' |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3913 # Some comment |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3914 .. '<F3> a' |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3915 .. 'b' |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3916 .. 'c' |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3917 enddef |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3918 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3919 v9.CheckScriptSuccess(lines) |
24471
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3920 var res = execute('verbose nmap <F3>') |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3921 assert_match('No mapping found', res) |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3922 |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3923 g:FuncA() |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3924 res = execute('verbose nmap <F3>') |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3925 assert_match(' <F3> .* abc.*Last set from .*XScriptSuccess\d\+ line 11', res) |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3926 |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3927 nunmap <F3> |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3928 delfunc g:FuncA |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3929 enddef |
baf75c8e1b7b
patch 8.2.2775: Vim9: wrong line number used for some commands
Bram Moolenaar <Bram@vim.org>
parents:
24469
diff
changeset
|
3930 |
25176
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3931 def Test_option_set() |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3932 # legacy script allows for white space |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3933 var lines =<< trim END |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3934 set foldlevel =11 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3935 call assert_equal(11, &foldlevel) |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3936 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3937 v9.CheckScriptSuccess(lines) |
25176
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3938 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3939 set foldlevel |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3940 set foldlevel=12 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3941 assert_equal(12, &foldlevel) |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3942 set foldlevel+=2 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3943 assert_equal(14, &foldlevel) |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3944 set foldlevel-=3 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3945 assert_equal(11, &foldlevel) |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3946 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3947 lines =<< trim END |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3948 set foldlevel =1 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3949 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3950 v9.CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: =1') |
25176
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3951 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3952 lines =<< trim END |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3953 set foldlevel +=1 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3954 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3955 v9.CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: +=1') |
25176
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3956 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3957 lines =<< trim END |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3958 set foldlevel ^=1 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3959 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3960 v9.CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: ^=1') |
25176
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3961 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3962 lines =<< trim END |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3963 set foldlevel -=1 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3964 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3965 v9.CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: -=1') |
25176
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3966 |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3967 set foldlevel& |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3968 enddef |
af3d0198faad
patch 8.2.3124: Vim9: no error for white space between option and "=9"
Bram Moolenaar <Bram@vim.org>
parents:
25174
diff
changeset
|
3969 |
24968
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3970 def Test_option_modifier() |
25174
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3971 # legacy script allows for white space |
24968
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3972 var lines =<< trim END |
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3973 set hlsearch & hlsearch ! |
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3974 call assert_equal(1, &hlsearch) |
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3975 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3976 v9.CheckScriptSuccess(lines) |
24968
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3977 |
25174
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3978 set hlsearch |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3979 set hlsearch! |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3980 assert_equal(false, &hlsearch) |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3981 |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3982 set hlsearch |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3983 set hlsearch& |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3984 assert_equal(false, &hlsearch) |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3985 |
24968
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3986 lines =<< trim END |
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3987 set hlsearch & |
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3988 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3989 v9.CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: &') |
24968
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3990 |
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3991 lines =<< trim END |
25174
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3992 set hlsearch ! |
24968
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3993 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
3994 v9.CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: !') |
25174
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3995 |
b32c83317492
patch 8.2.3123: Vim9: confusing error when using white space after option
Bram Moolenaar <Bram@vim.org>
parents:
25164
diff
changeset
|
3996 set hlsearch& |
24968
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3997 enddef |
d81a5c3a3aa6
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.
Bram Moolenaar <Bram@vim.org>
parents:
24958
diff
changeset
|
3998 |
25220
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
3999 " This must be called last, it may cause following :def functions to fail |
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4000 def Test_xxx_echoerr_line_number() |
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4001 var lines =<< trim END |
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4002 echoerr 'some' |
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4003 .. ' error' |
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4004 .. ' continued' |
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4005 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4006 v9.CheckDefExecAndScriptFailure(lines, 'some error continued', 1) |
25220
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4007 enddef |
89b39ce243e2
patch 8.2.3146: Vim9: line number wrong for :execute argument
Bram Moolenaar <Bram@vim.org>
parents:
25218
diff
changeset
|
4008 |
26496
8861ece40b4b
patch 8.2.3778: lambda debug test fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
26490
diff
changeset
|
4009 func Test_debug_with_lambda() |
26490
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4010 CheckRunVimInTerminal |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4011 |
26496
8861ece40b4b
patch 8.2.3778: lambda debug test fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
26490
diff
changeset
|
4012 " call indirectly to avoid compilation error for missing functions |
8861ece40b4b
patch 8.2.3778: lambda debug test fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
26490
diff
changeset
|
4013 call Run_Test_debug_with_lambda() |
8861ece40b4b
patch 8.2.3778: lambda debug test fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
26490
diff
changeset
|
4014 endfunc |
8861ece40b4b
patch 8.2.3778: lambda debug test fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
26490
diff
changeset
|
4015 |
8861ece40b4b
patch 8.2.3778: lambda debug test fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
26490
diff
changeset
|
4016 def Run_Test_debug_with_lambda() |
26490
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4017 var lines =<< trim END |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4018 vim9script |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4019 def Func() |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4020 var n = 0 |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4021 echo [0]->filter((_, v) => v == n) |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4022 enddef |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4023 breakadd func Func |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4024 Func() |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4025 END |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4026 writefile(lines, 'XdebugFunc') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4027 var buf = g:RunVimInTerminal('-S XdebugFunc', {rows: 6, wait_for_ruler: 0}) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4028 g:WaitForAssert(() => assert_match('^>', term_getline(buf, 6))) |
26490
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4029 |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4030 term_sendkeys(buf, "cont\<CR>") |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4031 g:WaitForAssert(() => assert_match('\[0\]', term_getline(buf, 5))) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4032 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4033 g:StopVimInTerminal(buf) |
26490
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4034 delete('XdebugFunc') |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4035 enddef |
cd452f46085e
patch 8.2.3775: Vim9: lambda compiled without outer context when debugging
Bram Moolenaar <Bram@vim.org>
parents:
26430
diff
changeset
|
4036 |
26698
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4037 func Test_debug_running_out_of_lines() |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4038 CheckRunVimInTerminal |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4039 |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4040 " call indirectly to avoid compilation error for missing functions |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4041 call Run_Test_debug_running_out_of_lines() |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4042 endfunc |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4043 |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4044 def Run_Test_debug_running_out_of_lines() |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4045 var lines =<< trim END |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4046 vim9script |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4047 def Crash() |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4048 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4049 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4050 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4051 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4052 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4053 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4054 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4055 if true |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4056 # |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4057 endif |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4058 enddef |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4059 breakadd func Crash |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4060 Crash() |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4061 END |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4062 writefile(lines, 'XdebugFunc') |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4063 var buf = g:RunVimInTerminal('-S XdebugFunc', {rows: 6, wait_for_ruler: 0}) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4064 g:WaitForAssert(() => assert_match('^>', term_getline(buf, 6))) |
26698
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4065 |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4066 term_sendkeys(buf, "next\<CR>") |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4067 g:TermWait(buf) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4068 g:WaitForAssert(() => assert_match('^>', term_getline(buf, 6))) |
26698
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4069 |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4070 term_sendkeys(buf, "cont\<CR>") |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4071 g:TermWait(buf) |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4072 |
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4073 g:StopVimInTerminal(buf) |
26698
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4074 delete('XdebugFunc') |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4075 enddef |
254fffd11fda
patch 8.2.3878: Vim9: debugger tries to read more lines than there are
Bram Moolenaar <Bram@vim.org>
parents:
26660
diff
changeset
|
4076 |
27237
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4077 def Test_ambigous_command_error() |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4078 var lines =<< trim END |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4079 vim9script |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4080 command CmdA echomsg 'CmdA' |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4081 command CmdB echomsg 'CmdB' |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4082 Cmd |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4083 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4084 v9.CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 4) |
27237
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4085 |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4086 lines =<< trim END |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4087 vim9script |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4088 def Func() |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4089 Cmd |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4090 enddef |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4091 Func() |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4092 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4093 v9.CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 1) |
27237
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4094 |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4095 lines =<< trim END |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4096 vim9script |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4097 nnoremap <F3> <ScriptCmd>Cmd<CR> |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4098 feedkeys("\<F3>", 'xt') |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4099 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27237
diff
changeset
|
4100 v9.CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 3) |
27237
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4101 |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4102 delcommand CmdA |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4103 delcommand CmdB |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4104 nunmap <F3> |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4105 enddef |
44cb142c8615
patch 8.2.4147: E464 does not always include the offending command
Bram Moolenaar <Bram@vim.org>
parents:
27084
diff
changeset
|
4106 |
26211
485c7c4afeb7
patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents:
26048
diff
changeset
|
4107 " Execute this near the end, profiling doesn't stop until Vim exits. |
25214
218df177cff8
patch 8.2.3143: Vim9: wrong context if lambda called from profiled function
Bram Moolenaar <Bram@vim.org>
parents:
25202
diff
changeset
|
4108 " This only tests that it works, not the profiling output. |
28079
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4109 def Test_profile_with_lambda() |
25218
645c7963a586
patch 8.2.3145: Vim9: profile test fails without profile feature
Bram Moolenaar <Bram@vim.org>
parents:
25214
diff
changeset
|
4110 CheckFeature profile |
645c7963a586
patch 8.2.3145: Vim9: profile test fails without profile feature
Bram Moolenaar <Bram@vim.org>
parents:
25214
diff
changeset
|
4111 |
28079
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4112 var lines =<< trim END |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4113 vim9script |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4114 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4115 def ProfiledWithLambda() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4116 var n = 3 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4117 echo [[1, 2], [3, 4]]->filter((_, l) => l[0] == n) |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4118 enddef |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4119 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4120 def ProfiledNested() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4121 var x = 0 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4122 def Nested(): any |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4123 return x |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4124 enddef |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4125 Nested() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4126 enddef |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4127 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4128 def g:ProfiledNestedProfiled() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4129 var x = 0 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4130 def Nested(): any |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4131 return x |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4132 enddef |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4133 Nested() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4134 enddef |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4135 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4136 def Profile() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4137 ProfiledWithLambda() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4138 ProfiledNested() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4139 |
28099
2cee7204d844
patch 8.2.4574: Vim9: test for profiling fails
Bram Moolenaar <Bram@vim.org>
parents:
28079
diff
changeset
|
4140 # Also profile the nested function. Use a different function, although |
2cee7204d844
patch 8.2.4574: Vim9: test for profiling fails
Bram Moolenaar <Bram@vim.org>
parents:
28079
diff
changeset
|
4141 # the contents is the same, to make sure it was not already compiled. |
28079
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4142 profile func * |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4143 g:ProfiledNestedProfiled() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4144 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4145 profdel func * |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4146 profile pause |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4147 enddef |
28115
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4148 |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4149 var result = 'done' |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4150 try |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4151 # mark functions for profiling now to avoid E1271 |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4152 profile start Xprofile.log |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4153 profile func ProfiledWithLambda |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4154 profile func ProfiledNested |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4155 |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4156 Profile() |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4157 catch |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4158 result = 'failed: ' .. v:exception |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4159 finally |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4160 writefile([result], 'Xdidprofile') |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4161 endtry |
28079
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4162 END |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4163 writefile(lines, 'Xprofile.vim') |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4164 call system(g:GetVimCommand() |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4165 .. ' --clean' |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4166 .. ' -c "so Xprofile.vim"' |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4167 .. ' -c "qall!"') |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4168 call assert_equal(0, v:shell_error) |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4169 |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4170 assert_equal(['done'], readfile('Xdidprofile')) |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4171 assert_true(filereadable('Xprofile.log')) |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4172 delete('Xdidprofile') |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4173 delete('Xprofile.log') |
c4ba8f3117ca
patch 8.2.4564: running test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents:
28035
diff
changeset
|
4174 delete('Xprofile.vim') |
25214
218df177cff8
patch 8.2.3143: Vim9: wrong context if lambda called from profiled function
Bram Moolenaar <Bram@vim.org>
parents:
25202
diff
changeset
|
4175 enddef |
218df177cff8
patch 8.2.3143: Vim9: wrong context if lambda called from profiled function
Bram Moolenaar <Bram@vim.org>
parents:
25202
diff
changeset
|
4176 |
28117
106795d5106e
patch 8.2.4583: screendump test fails
Bram Moolenaar <Bram@vim.org>
parents:
28115
diff
changeset
|
4177 func Test_misplaced_type() |
106795d5106e
patch 8.2.4583: screendump test fails
Bram Moolenaar <Bram@vim.org>
parents:
28115
diff
changeset
|
4178 CheckRunVimInTerminal |
106795d5106e
patch 8.2.4583: screendump test fails
Bram Moolenaar <Bram@vim.org>
parents:
28115
diff
changeset
|
4179 call Run_Test_misplaced_type() |
106795d5106e
patch 8.2.4583: screendump test fails
Bram Moolenaar <Bram@vim.org>
parents:
28115
diff
changeset
|
4180 endfunc |
106795d5106e
patch 8.2.4583: screendump test fails
Bram Moolenaar <Bram@vim.org>
parents:
28115
diff
changeset
|
4181 |
106795d5106e
patch 8.2.4583: screendump test fails
Bram Moolenaar <Bram@vim.org>
parents:
28115
diff
changeset
|
4182 def Run_Test_misplaced_type() |
28115
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4183 writefile(['let g:somevar = "asdf"'], 'XTest_misplaced_type') |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4184 var buf = g:RunVimInTerminal('-S XTest_misplaced_type', {'rows': 6}) |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4185 term_sendkeys(buf, ":vim9cmd echo islocked('g:somevar: string')\<CR>") |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4186 g:VerifyScreenDump(buf, 'Test_misplaced_type', {}) |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4187 |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4188 g:StopVimInTerminal(buf) |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4189 delete('XTest_misplaced_type') |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4190 enddef |
62a57c60edc1
patch 8.2.4582: useless code handling a type declaration
Bram Moolenaar <Bram@vim.org>
parents:
28099
diff
changeset
|
4191 |
28646
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4192 " Ensure echo doesn't crash when stringifying empty variables. |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4193 def Test_echo_uninit_variables() |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4194 var res: string |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4195 |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4196 var var_bool: bool |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4197 var var_num: number |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4198 var var_float: float |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4199 var Var_func: func |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4200 var var_string: string |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4201 var var_blob: blob |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4202 var var_list: list<any> |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4203 var var_dict: dict<any> |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4204 |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4205 redir => res |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4206 echo var_bool |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4207 echo var_num |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4208 echo var_float |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4209 echo Var_func |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4210 echo var_string |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4211 echo var_blob |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4212 echo var_list |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4213 echo var_dict |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4214 redir END |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4215 |
28721
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4216 assert_equal(['false', '0', '0.0', 'function()', '', '0z', '[]', '{}'], res->split('\n')) |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4217 |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4218 if has('job') |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4219 var var_job: job |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4220 var var_channel: channel |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4221 |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4222 redir => res |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4223 echo var_job |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4224 echo var_channel |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4225 redir END |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4226 |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4227 assert_equal(['no process', 'channel fail'], res->split('\n')) |
ec4086492eda
patch 8.2.4885: test fails with the job/channel feature
Bram Moolenaar <Bram@vim.org>
parents:
28719
diff
changeset
|
4228 endif |
28646
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4229 enddef |
a2cf17d0d5da
patch 8.2.4847: crash when using uninitialized function pointer
Bram Moolenaar <Bram@vim.org>
parents:
28623
diff
changeset
|
4230 |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4231 " 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
|
4232 def Test_substitute_cmd() |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4233 new |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4234 setline(1, 'something') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4235 :substitute(some(other( |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4236 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
|
4237 bwipe! |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4238 |
21353
fb8c8fcb7b60
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
4239 # also when the context is Vim9 script |
22415
1cefe1c013ac
patch 8.2.1756: Vim9: :let will soon be disallowed
Bram Moolenaar <Bram@vim.org>
parents:
22395
diff
changeset
|
4240 var lines =<< trim END |
19894
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4241 vim9script |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4242 new |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4243 setline(1, 'something') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4244 :substitute(some(other( |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4245 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
|
4246 bwipe! |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4247 END |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4248 writefile(lines, 'Xvim9lines') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4249 source Xvim9lines |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4250 |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4251 delete('Xvim9lines') |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4252 enddef |
ea4f8e789627
patch 8.2.0503: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4253 |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4254 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |