annotate src/testdir/test_vim9_disassemble.vim @ 26470:ff0310e6f889 v8.2.3765

patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others Commit: https://github.com/vim/vim/commit/dcb53be4418fe263a71c7738315241031df6c986 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 9 14:23:43 2021 +0000 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others Problem: Vim9: cannot use a lambda for 'opfunc' and others. Solution: Convert the lambda to a string.
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 Dec 2021 15:30:04 +0100
parents f5727e2603f0
children b12d8a5af20e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test the :disassemble command, and compilation as a side effect
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
19572
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
3 source check.vim
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
4
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 func NotCompiled()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 echo "not"
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 endfunc
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 let s:scriptvar = 4
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 let g:globalvar = 'g'
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
11 let b:buffervar = 'b'
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
12 let w:windowvar = 'w'
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
13 let t:tabpagevar = 't'
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 def s:ScriptFuncLoad(arg: string)
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
16 var local = 1
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 buffers
23183
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
18 echo
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 echo arg
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 echo local
20301
e1a8d2040bd7 patch 8.2.0706: Vim9: using assert_fails() causes function to finish
Bram Moolenaar <Bram@vim.org>
parents: 20295
diff changeset
21 echo &lines
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 echo v:version
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 echo s:scriptvar
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 echo g:globalvar
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
25 echo get(g:, "global")
23233
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
26 echo g:auto#var
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
27 echo b:buffervar
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
28 echo get(b:, "buffer")
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
29 echo w:windowvar
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
30 echo get(w:, "window")
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
31 echo t:tabpagevar
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
32 echo get(t:, "tab")
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 echo &tabstop
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 echo $ENVVAR
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 echo @z
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
38 def Test_disassemble_load()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 assert_fails('disass NoFunc', 'E1061:')
21821
0deb6f96a5a3 patch 8.2.1460: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents: 21771
diff changeset
40 assert_fails('disass NotCompiled', 'E1091:')
19390
e4b326c9424a patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents: 19342
diff changeset
41 assert_fails('disass', 'E471:')
e4b326c9424a patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents: 19342
diff changeset
42 assert_fails('disass [', 'E475:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21232
diff changeset
43 assert_fails('disass 234', 'E129:')
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21232
diff changeset
44 assert_fails('disass <XX>foo', 'E129:')
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
46 var res = execute('disass s:ScriptFuncLoad')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
47 assert_match('<SNR>\d*_ScriptFuncLoad.*' ..
23183
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
48 'buffers\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
49 '\d\+ EXEC \+buffers\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
50 'echo\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
51 'echo arg\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
52 '\d\+ LOAD arg\[-1\]\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
53 '\d\+ ECHO 1\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
54 'echo local\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
55 '\d\+ LOAD $0\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
56 '\d\+ ECHO 1\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
57 'echo &lines\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
58 '\d\+ LOADOPT &lines\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
59 '\d\+ ECHO 1\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
60 'echo v:version\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
61 '\d\+ LOADV v:version\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
62 '\d\+ ECHO 1\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
63 'echo s:scriptvar\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
64 '\d\+ LOADS s:scriptvar from .*test_vim9_disassemble.vim\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
65 '\d\+ ECHO 1\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
66 'echo g:globalvar\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
67 '\d\+ LOADG g:globalvar\_s*' ..
4d5d12138b36 patch 8.2.2137: Vim9: :echo and :execute give error for empty argument
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
68 '\d\+ ECHO 1\_s*' ..
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
69 'echo get(g:, "global")\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
70 '\d\+ LOAD g:\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
71 '\d\+ PUSHS "global"\_s*' ..
23233
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
72 '\d\+ BCALL get(argc 2)\_s*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
73 '\d\+ ECHO 1\_s*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
74 'echo g:auto#var\_s*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
75 '\d\+ LOADAUTO g:auto#var\_s*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
76 '\d\+ ECHO 1\_s*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
77 'echo b:buffervar\_s*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
78 '\d\+ LOADB b:buffervar\_s*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
79 '\d\+ ECHO 1\_s*' ..
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
80 'echo get(b:, "buffer")\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
81 '\d\+ LOAD b:\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
82 '\d\+ PUSHS "buffer"\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
83 '\d\+ BCALL get(argc 2).*' ..
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
84 ' LOADW w:windowvar.*' ..
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
85 'echo get(w:, "window")\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
86 '\d\+ LOAD w:\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
87 '\d\+ PUSHS "window"\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
88 '\d\+ BCALL get(argc 2).*' ..
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
89 ' LOADT t:tabpagevar.*' ..
21399
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
90 'echo get(t:, "tab")\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
91 '\d\+ LOAD t:\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
92 '\d\+ PUSHS "tab"\_s*' ..
5cb6e676defd patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Bram Moolenaar <Bram@vim.org>
parents: 21397
diff changeset
93 '\d\+ BCALL get(argc 2).*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
94 ' LOADENV $ENVVAR.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
95 ' LOADREG @z.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
96 res)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
99 def s:EditExpand()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
100 var filename = "file"
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
101 var filenr = 123
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
102 edit the`=filename``=filenr`.txt
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
103 enddef
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
104
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
105 def Test_disassemble_exec_expr()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
106 var res = execute('disass s:EditExpand')
21755
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
107 assert_match('<SNR>\d*_EditExpand\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
108 ' var filename = "file"\_s*' ..
21755
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
109 '\d PUSHS "file"\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
110 '\d STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
111 ' var filenr = 123\_s*' ..
21755
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
112 '\d STORE 123 in $1\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
113 ' edit the`=filename``=filenr`.txt\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
114 '\d PUSHS "edit the"\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
115 '\d LOAD $0\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
116 '\d LOAD $1\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
117 '\d 2STRING stack\[-1\]\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
118 '\d\+ PUSHS ".txt"\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
119 '\d\+ EXECCONCAT 4\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
120 '\d\+ RETURN void',
21755
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
121 res)
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
122 enddef
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
123
24826
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
124 if has('python3')
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
125 def s:PyHeredoc()
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
126 python3 << EOF
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
127 print('hello')
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
128 EOF
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
129 enddef
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
130
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
131 def Test_disassemble_python_heredoc()
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
132 var res = execute('disass s:PyHeredoc')
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
133 assert_match('<SNR>\d*_PyHeredoc.*' ..
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
134 " python3 << EOF^@ print('hello')^@EOF\\_s*" ..
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
135 '\d EXEC_SPLIT python3 << EOF^@ print(''hello'')^@EOF\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
136 '\d RETURN void',
24826
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
137 res)
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
138 enddef
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
139 endif
a8d64f1a223b patch 8.2.2951: Vim9: cannot use heredoc for :python, :lua, etc.
Bram Moolenaar <Bram@vim.org>
parents: 24796
diff changeset
140
24488
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
141 def s:Substitute()
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
142 var expr = "abc"
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
143 :%s/a/\=expr/&g#c
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
144 enddef
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
145
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
146 def Test_disassemble_substitute()
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
147 var res = execute('disass s:Substitute')
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
148 assert_match('<SNR>\d*_Substitute.*' ..
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
149 ' var expr = "abc"\_s*' ..
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
150 '\d PUSHS "abc"\_s*' ..
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
151 '\d STORE $0\_s*' ..
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
152 ' :%s/a/\\=expr/&g#c\_s*' ..
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
153 '\d SUBSTITUTE :%s/a/\\=expr/&g#c\_s*' ..
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
154 ' 0 LOAD $0\_s*' ..
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
155 ' -------------\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
156 '\d RETURN void',
24488
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
157 res)
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
158 enddef
f293bb501b30 patch 8.2.2784: Vim9: cannot use =expr in :substitute
Bram Moolenaar <Bram@vim.org>
parents: 24475
diff changeset
159
24606
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
160
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
161 def s:SearchPair()
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
162 var col = 8
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
163 searchpair("{", "", "}", "", "col('.') > col")
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
164 enddef
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
165
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
166 def Test_disassemble_seachpair()
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
167 var res = execute('disass s:SearchPair')
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
168 assert_match('<SNR>\d*_SearchPair.*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
169 ' var col = 8\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
170 '\d STORE 8 in $0\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
171 ' searchpair("{", "", "}", "", "col(''.'') > col")\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
172 '\d PUSHS "{"\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
173 '\d PUSHS ""\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
174 '\d PUSHS "}"\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
175 '\d PUSHS ""\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
176 '\d INSTR\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
177 ' 0 PUSHS "."\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
178 ' 1 BCALL col(argc 1)\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
179 ' 2 LOAD $0\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
180 ' 3 COMPARENR >\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
181 ' -------------\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
182 '\d BCALL searchpair(argc 5)\_s*' ..
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
183 '\d DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
184 '\d RETURN void',
24606
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
185 res)
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
186 enddef
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
187
a4fda40e0bb9 patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 24590
diff changeset
188
24490
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
189 def s:RedirVar()
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
190 var result: string
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
191 redir =>> result
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
192 echo "text"
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
193 redir END
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
194 enddef
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
195
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
196 def Test_disassemble_redir_var()
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
197 var res = execute('disass s:RedirVar')
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
198 assert_match('<SNR>\d*_RedirVar.*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
199 ' var result: string\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
200 '\d PUSHS "\[NULL\]"\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
201 '\d STORE $0\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
202 ' redir =>> result\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
203 '\d REDIR\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
204 ' echo "text"\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
205 '\d PUSHS "text"\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
206 '\d ECHO 1\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
207 ' redir END\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
208 '\d LOAD $0\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
209 '\d REDIR END\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
210 '\d CONCAT\_s*' ..
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
211 '\d STORE $0\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
212 '\d RETURN void',
24490
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
213 res)
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
214 enddef
08050e45bd06 patch 8.2.2785: Vim9: cannot redirect to local variable
Bram Moolenaar <Bram@vim.org>
parents: 24488
diff changeset
215
24590
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
216 def s:Cexpr()
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
217 var errors = "list of errors"
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
218 cexpr errors
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
219 enddef
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
220
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
221 def Test_disassemble_cexpr()
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
222 var res = execute('disass s:Cexpr')
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
223 assert_match('<SNR>\d*_Cexpr.*' ..
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
224 ' var errors = "list of errors"\_s*' ..
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
225 '\d PUSHS "list of errors"\_s*' ..
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
226 '\d STORE $0\_s*' ..
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
227 ' cexpr errors\_s*' ..
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
228 '\d CEXPR pre cexpr\_s*' ..
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
229 '\d LOAD $0\_s*' ..
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
230 '\d CEXPR core cexpr "cexpr errors"\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
231 '\d RETURN void',
24590
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
232 res)
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
233 enddef
2818f846f099 patch 8.2.2834: Vim9: :cexpr does not work with local variables
Bram Moolenaar <Bram@vim.org>
parents: 24504
diff changeset
234
21755
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
235 def s:YankRange()
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
236 norm! m[jjm]
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
237 :'[,']yank
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
238 enddef
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
239
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
240 def Test_disassemble_yank_range()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
241 var res = execute('disass s:YankRange')
21755
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
242 assert_match('<SNR>\d*_YankRange.*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
243 ' norm! m\[jjm\]\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
244 '\d EXEC norm! m\[jjm\]\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
245 ' :''\[,''\]yank\_s*' ..
3b312e56e2b8 patch 8.2.1427: Vim9: cannot use a range with marks in :def function
Bram Moolenaar <Bram@vim.org>
parents: 21717
diff changeset
246 '\d EXEC :''\[,''\]yank\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
247 '\d RETURN void',
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
248 res)
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
249 enddef
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents: 20142
diff changeset
250
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
251 def s:PutExpr()
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
252 :3put ="text"
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
253 enddef
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
254
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
255 def Test_disassemble_put_expr()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
256 var res = execute('disass s:PutExpr')
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
257 assert_match('<SNR>\d*_PutExpr.*' ..
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
258 ' :3put ="text"\_s*' ..
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
259 '\d PUSHS "text"\_s*' ..
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
260 '\d PUT = 3\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
261 '\d RETURN void',
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
262 res)
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
263 enddef
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
264
23156
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
265 def s:PutRange()
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
266 :$-2put a
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
267 enddef
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
268
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
269 def Test_disassemble_put_range()
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
270 var res = execute('disass s:PutRange')
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
271 assert_match('<SNR>\d*_PutRange.*' ..
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
272 ' :$-2put a\_s*' ..
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
273 '\d RANGE $-2\_s*' ..
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
274 '\d PUT a range\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
275 '\d RETURN void',
23156
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
276 res)
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
277 enddef
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
278
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 def s:ScriptFuncPush()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
280 var localbool = true
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
281 var localspec = v:none
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
282 var localblob = 0z1234
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 if has('float')
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
284 var localfloat = 1.234
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 endif
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
288 def Test_disassemble_push()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
289 var res = execute('disass s:ScriptFuncPush')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
290 assert_match('<SNR>\d*_ScriptFuncPush.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
291 'localbool = true.*' ..
23438
4c6ebf531284 patch 8.2.2262: Vim9: converting bool to string prefixes v:
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
292 ' PUSH true.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
293 'localspec = v:none.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
294 ' PUSH v:none.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
295 'localblob = 0z1234.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
296 ' PUSHBLOB 0z1234.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
297 res)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 if has('float')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
299 assert_match('<SNR>\d*_ScriptFuncPush.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
300 'localfloat = 1.234.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
301 ' PUSHF 1.234.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
302 res)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 endif
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 def s:ScriptFuncStore()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
307 var localnr = 1
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 localnr = 2
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
309 var localstr = 'abc'
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 localstr = 'xyz'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 v:char = 'abc'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 s:scriptvar = 'sv'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 g:globalvar = 'gv'
23233
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
314 g:auto#var = 'av'
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
315 b:buffervar = 'bv'
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
316 w:windowvar = 'wv'
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
317 t:tabpagevar = 'tv'
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 &tabstop = 8
26470
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
319 &opfunc = (t) => len(t)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 $ENVVAR = 'ev'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 @z = 'rv'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
324 def Test_disassemble_store()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
325 var res = execute('disass s:ScriptFuncStore')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
326 assert_match('<SNR>\d*_ScriptFuncStore.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
327 'var localnr = 1.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
328 'localnr = 2.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
329 ' STORE 2 in $0.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
330 'var localstr = ''abc''.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
331 'localstr = ''xyz''.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
332 ' STORE $1.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
333 'v:char = ''abc''.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
334 'STOREV v:char.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
335 's:scriptvar = ''sv''.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
336 ' STORES s:scriptvar in .*test_vim9_disassemble.vim.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
337 'g:globalvar = ''gv''.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
338 ' STOREG g:globalvar.*' ..
23233
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
339 'g:auto#var = ''av''.*' ..
657216220293 patch 8.2.2162: Vim9: Cannot load or store autoload variables
Bram Moolenaar <Bram@vim.org>
parents: 23183
diff changeset
340 ' STOREAUTO g:auto#var.*' ..
20089
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
341 'b:buffervar = ''bv''.*' ..
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
342 ' STOREB b:buffervar.*' ..
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
343 'w:windowvar = ''wv''.*' ..
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
344 ' STOREW w:windowvar.*' ..
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
345 't:tabpagevar = ''tv''.*' ..
7fc5d62fe2a5 patch 8.2.0600: Vim9: cannot read or write w:, t: and b: variables
Bram Moolenaar <Bram@vim.org>
parents: 20079
diff changeset
346 ' STORET t:tabpagevar.*' ..
26470
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
347 '&tabstop = 8\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
348 '\d\+ PUSHNR 8\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
349 '\d\+ STOREOPT &tabstop\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
350 '&opfunc = (t) => len(t)\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
351 '\d\+ FUNCREF <lambda>\d\+\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
352 '\d\+ STOREFUNCOPT &opfunc\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
353 '$ENVVAR = ''ev''\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
354 '\d\+ PUSHS "ev"\_s*' ..
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
355 '\d\+ STOREENV $ENVVAR\_s*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
356 '@z = ''rv''.*' ..
26470
ff0310e6f889 patch 8.2.3765: Vim9: cannot use a lambda for 'opfunc' and others
Bram Moolenaar <Bram@vim.org>
parents: 26372
diff changeset
357 '\d\+ STOREREG @z.*',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
358 res)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
361 def s:ScriptFuncStoreMember()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
362 var locallist: list<number> = []
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
363 locallist[0] = 123
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
364 var localdict: dict<number> = {}
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
365 localdict["a"] = 456
24475
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
366 var localblob: blob = 0z1122
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
367 localblob[1] = 33
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
368 enddef
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
369
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
370 def Test_disassemble_store_member()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
371 var res = execute('disass s:ScriptFuncStoreMember')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
372 assert_match('<SNR>\d*_ScriptFuncStoreMember\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
373 'var locallist: list<number> = []\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
374 '\d NEWLIST size 0\_s*' ..
23458
d2b1269c2c68 patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents: 23438
diff changeset
375 '\d SETTYPE list<number>\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
376 '\d STORE $0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
377 'locallist\[0\] = 123\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
378 '\d PUSHNR 123\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
379 '\d PUSHNR 0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
380 '\d LOAD $0\_s*' ..
24475
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
381 '\d STOREINDEX list\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
382 'var localdict: dict<number> = {}\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
383 '\d NEWDICT size 0\_s*' ..
23458
d2b1269c2c68 patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents: 23438
diff changeset
384 '\d SETTYPE dict<number>\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
385 '\d STORE $1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
386 'localdict\["a"\] = 456\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
387 '\d\+ PUSHNR 456\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
388 '\d\+ PUSHS "a"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
389 '\d\+ LOAD $1\_s*' ..
24475
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
390 '\d\+ STOREINDEX dict\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
391 'var localblob: blob = 0z1122\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
392 '\d\+ PUSHBLOB 0z1122\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
393 '\d\+ STORE $2\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
394 'localblob\[1\] = 33\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
395 '\d\+ PUSHNR 33\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
396 '\d\+ PUSHNR 1\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
397 '\d\+ LOAD $2\_s*' ..
96905804bf5a patch 8.2.2777: Vim9: blob operations not tested in all ways
Bram Moolenaar <Bram@vim.org>
parents: 24444
diff changeset
398 '\d\+ STOREINDEX blob\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
399 '\d\+ RETURN void',
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
400 res)
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
401 enddef
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
402
23266
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
403 def s:ScriptFuncStoreIndex()
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
404 var d = {dd: {}}
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
405 d.dd[0] = 0
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
406 enddef
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
407
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
408 def Test_disassemble_store_index()
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
409 var res = execute('disass s:ScriptFuncStoreIndex')
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
410 assert_match('<SNR>\d*_ScriptFuncStoreIndex\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
411 'var d = {dd: {}}\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
412 '\d PUSHS "dd"\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
413 '\d NEWDICT size 0\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
414 '\d NEWDICT size 1\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
415 '\d STORE $0\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
416 'd.dd\[0\] = 0\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
417 '\d PUSHNR 0\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
418 '\d PUSHNR 0\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
419 '\d LOAD $0\_s*' ..
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
420 '\d MEMBER dd\_s*' ..
25800
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
421 '\d\+ USEDICT\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
422 '\d\+ STOREINDEX any\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
423 '\d\+ RETURN void',
23266
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
424 res)
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
425 enddef
00f7cd9b6033 patch 8.2.2179: Vim9: crash when indexing a dict with a number
Bram Moolenaar <Bram@vim.org>
parents: 23233
diff changeset
426
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
427 def s:ListAssign()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
428 var x: string
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
429 var y: string
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
430 var l: list<any>
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
431 [x, y; l] = g:stringlist
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
432 enddef
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
433
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
434 def Test_disassemble_list_assign()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
435 var res = execute('disass s:ListAssign')
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
436 assert_match('<SNR>\d*_ListAssign\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
437 'var x: string\_s*' ..
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
438 '\d PUSHS "\[NULL\]"\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
439 '\d STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
440 'var y: string\_s*' ..
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
441 '\d PUSHS "\[NULL\]"\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
442 '\d STORE $1\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
443 'var l: list<any>\_s*' ..
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
444 '\d NEWLIST size 0\_s*' ..
25579
d8fb5bb88362 patch 8.2.3326: Vim9: no error passing an empty list of the wrong type
Bram Moolenaar <Bram@vim.org>
parents: 25547
diff changeset
445 '\d SETTYPE list<any>\_s*' ..
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
446 '\d STORE $2\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
447 '\[x, y; l\] = g:stringlist\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
448 '\d LOADG g:stringlist\_s*' ..
22284
6b385c2b9ff5 patch 8.2.1691: Vim9: list<any> is not accepted where list<number> is expected
Bram Moolenaar <Bram@vim.org>
parents: 22196
diff changeset
449 '\d CHECKTYPE list<any> stack\[-1\]\_s*' ..
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
450 '\d CHECKLEN >= 2\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
451 '\d\+ ITEM 0\_s*' ..
25547
ec4df0b982da patch 8.2.3310: Vim9: unpack assignment does not mention source of type error
Bram Moolenaar <Bram@vim.org>
parents: 25541
diff changeset
452 '\d\+ CHECKTYPE string stack\[-1\] arg 1\_s*' ..
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
453 '\d\+ STORE $0\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
454 '\d\+ ITEM 1\_s*' ..
25547
ec4df0b982da patch 8.2.3310: Vim9: unpack assignment does not mention source of type error
Bram Moolenaar <Bram@vim.org>
parents: 25541
diff changeset
455 '\d\+ CHECKTYPE string stack\[-1\] arg 2\_s*' ..
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
456 '\d\+ STORE $1\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
457 '\d\+ SLICE 2\_s*' ..
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
458 '\d\+ STORE $2\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
459 '\d\+ RETURN void',
20913
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
460 res)
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
461 enddef
a127db33a075 patch 8.2.1008: Vim9: no test for disassambling newly added instructions
Bram Moolenaar <Bram@vim.org>
parents: 20909
diff changeset
462
24984
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
463 def s:ListAssignWithOp()
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
464 var a = 2
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
465 var b = 3
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
466 [a, b] += [4, 5]
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
467 enddef
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
468
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
469 def Test_disassemble_list_assign_with_op()
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
470 var res = execute('disass s:ListAssignWithOp')
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
471 assert_match('<SNR>\d*_ListAssignWithOp\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
472 'var a = 2\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
473 '\d STORE 2 in $0\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
474 'var b = 3\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
475 '\d STORE 3 in $1\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
476 '\[a, b\] += \[4, 5\]\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
477 '\d\+ PUSHNR 4\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
478 '\d\+ PUSHNR 5\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
479 '\d\+ NEWLIST size 2\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
480 '\d\+ LOAD $0\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
481 '\d\+ ITEM 0 with op\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
482 '\d\+ OPNR +\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
483 '\d\+ STORE $0\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
484 '\d\+ LOAD $1\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
485 '\d\+ ITEM 1 with op\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
486 '\d\+ OPNR +\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
487 '\d\+ STORE $1\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
488 '\d\+ DROP\_s*' ..
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
489 '\d\+ RETURN void',
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
490 res)
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
491 enddef
71b1e2ef0069 patch 8.2.3029: Vim9: crash when using operator and list unpack assignment
Bram Moolenaar <Bram@vim.org>
parents: 24936
diff changeset
492
22633
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
493 def s:ListAdd()
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
494 var l: list<number> = []
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
495 add(l, 123)
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
496 add(l, g:aNumber)
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
497 enddef
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
498
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
499 def Test_disassemble_list_add()
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
500 var res = execute('disass s:ListAdd')
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
501 assert_match('<SNR>\d*_ListAdd\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
502 'var l: list<number> = []\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
503 '\d NEWLIST size 0\_s*' ..
23458
d2b1269c2c68 patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents: 23438
diff changeset
504 '\d SETTYPE list<number>\_s*' ..
22633
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
505 '\d STORE $0\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
506 'add(l, 123)\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
507 '\d LOAD $0\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
508 '\d PUSHNR 123\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
509 '\d LISTAPPEND\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
510 '\d DROP\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
511 'add(l, g:aNumber)\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
512 '\d LOAD $0\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
513 '\d\+ LOADG g:aNumber\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
514 '\d\+ CHECKTYPE number stack\[-1\]\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
515 '\d\+ LISTAPPEND\_s*' ..
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
516 '\d\+ DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
517 '\d\+ RETURN void',
22633
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
518 res)
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
519 enddef
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
520
22637
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
521 def s:BlobAdd()
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
522 var b: blob = 0z
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
523 add(b, 123)
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
524 add(b, g:aNumber)
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
525 enddef
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
526
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
527 def Test_disassemble_blob_add()
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
528 var res = execute('disass s:BlobAdd')
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
529 assert_match('<SNR>\d*_BlobAdd\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
530 'var b: blob = 0z\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
531 '\d PUSHBLOB 0z\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
532 '\d STORE $0\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
533 'add(b, 123)\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
534 '\d LOAD $0\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
535 '\d PUSHNR 123\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
536 '\d BLOBAPPEND\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
537 '\d DROP\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
538 'add(b, g:aNumber)\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
539 '\d LOAD $0\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
540 '\d\+ LOADG g:aNumber\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
541 '\d\+ CHECKTYPE number stack\[-1\]\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
542 '\d\+ BLOBAPPEND\_s*' ..
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
543 '\d\+ DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
544 '\d\+ RETURN void',
22637
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
545 res)
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
546 enddef
4d4042683371 patch 8.2.1867: Vim9: argument to add() not checked for blob
Bram Moolenaar <Bram@vim.org>
parents: 22633
diff changeset
547
24444
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
548 def s:BlobIndexSlice()
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
549 var b: blob = 0z112233
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
550 echo b[1]
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
551 echo b[1 : 2]
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
552 enddef
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
553
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
554 def Test_disassemble_blob_index_slice()
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
555 var res = execute('disass s:BlobIndexSlice')
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
556 assert_match('<SNR>\d*_BlobIndexSlice\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
557 'var b: blob = 0z112233\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
558 '\d PUSHBLOB 0z112233\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
559 '\d STORE $0\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
560 'echo b\[1\]\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
561 '\d LOAD $0\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
562 '\d PUSHNR 1\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
563 '\d BLOBINDEX\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
564 '\d ECHO 1\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
565 'echo b\[1 : 2\]\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
566 '\d LOAD $0\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
567 '\d PUSHNR 1\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
568 '\d\+ PUSHNR 2\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
569 '\d\+ BLOBSLICE\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
570 '\d\+ ECHO 1\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
571 '\d\+ RETURN void',
24444
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
572 res)
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
573 enddef
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
574
20091
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
575 def s:ScriptFuncUnlet()
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
576 g:somevar = "value"
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
577 unlet g:somevar
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
578 unlet! g:somevar
20099
058b41f85bcb patch 8.2.0605: Vim9: cannot unlet an environment variable
Bram Moolenaar <Bram@vim.org>
parents: 20091
diff changeset
579 unlet $SOMEVAR
20091
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
580 enddef
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
581
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
582 def Test_disassemble_unlet()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
583 var res = execute('disass s:ScriptFuncUnlet')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
584 assert_match('<SNR>\d*_ScriptFuncUnlet\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
585 'g:somevar = "value"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
586 '\d PUSHS "value"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
587 '\d STOREG g:somevar\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
588 'unlet g:somevar\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
589 '\d UNLET g:somevar\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
590 'unlet! g:somevar\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
591 '\d UNLET! g:somevar\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
592 'unlet $SOMEVAR\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
593 '\d UNLETENV $SOMEVAR\_s*',
20091
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
594 res)
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
595 enddef
a64c16ff98b8 patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 20089
diff changeset
596
25605
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
597 def s:LockLocal()
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
598 var d = {a: 1}
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
599 lockvar d.a
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
600 enddef
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
601
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
602 def Test_disassemble_locl_local()
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
603 var res = execute('disass s:LockLocal')
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
604 assert_match('<SNR>\d*_LockLocal\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
605 'var d = {a: 1}\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
606 '\d PUSHS "a"\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
607 '\d PUSHNR 1\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
608 '\d NEWDICT size 1\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
609 '\d STORE $0\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
610 'lockvar d.a\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
611 '\d LOAD $0\_s*' ..
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
612 '\d LOCKUNLOCK lockvar d.a\_s*',
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
613 res)
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
614 enddef
6f13d9ea0d04 patch 8.2.3339: Vim9: cannot lock a member in a local dict
Bram Moolenaar <Bram@vim.org>
parents: 25579
diff changeset
615
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 def s:ScriptFuncTry()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617 try
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
618 echo "yes"
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 catch /fail/
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
620 echo "no"
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621 finally
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
622 throw "end"
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623 endtry
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
625
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
626 def Test_disassemble_try()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
627 var res = execute('disass s:ScriptFuncTry')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
628 assert_match('<SNR>\d*_ScriptFuncTry\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
629 'try\_s*' ..
23994
3daeb2060f25 patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 23927
diff changeset
630 '\d TRY catch -> \d\+, finally -> \d\+, endtry -> \d\+\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
631 'echo "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
632 '\d PUSHS "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
633 '\d ECHO 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
634 'catch /fail/\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
635 '\d JUMP -> \d\+\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
636 '\d PUSH v:exception\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
637 '\d PUSHS "fail"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
638 '\d COMPARESTRING =\~\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
639 '\d JUMP_IF_FALSE -> \d\+\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
640 '\d CATCH\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
641 'echo "no"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
642 '\d\+ PUSHS "no"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
643 '\d\+ ECHO 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
644 'finally\_s*' ..
23994
3daeb2060f25 patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 23927
diff changeset
645 '\d\+ FINALLY\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
646 'throw "end"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
647 '\d\+ PUSHS "end"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
648 '\d\+ THROW\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
649 'endtry\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
650 '\d\+ ENDTRY',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
651 res)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
653
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
654 def s:ScriptFuncNew()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
655 var ll = [1, "two", 333]
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
656 var dd = {one: 1, two: "val"}
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
657 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
658
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
659 def Test_disassemble_new()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
660 var res = execute('disass s:ScriptFuncNew')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
661 assert_match('<SNR>\d*_ScriptFuncNew\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
662 'var ll = \[1, "two", 333\]\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
663 '\d PUSHNR 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
664 '\d PUSHS "two"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
665 '\d PUSHNR 333\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
666 '\d NEWLIST size 3\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
667 '\d STORE $0\_s*' ..
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
668 'var dd = {one: 1, two: "val"}\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
669 '\d PUSHS "one"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
670 '\d PUSHNR 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
671 '\d PUSHS "two"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
672 '\d PUSHS "val"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
673 '\d NEWDICT size 2\_s*',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
674 res)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
675 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676
20029
8fb1cf4c44d5 patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents: 20019
diff changeset
677 def FuncWithArg(arg: any)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
678 echo arg
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
679 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
680
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 func UserFunc()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
682 echo 'nothing'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
683 endfunc
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
684
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
685 func UserFuncWithArg(arg)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
686 echo a:arg
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
687 endfunc
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
688
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
689 def s:ScriptFuncCall(): string
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
690 changenr()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
691 char2nr("abc")
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
692 Test_disassemble_new()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
693 FuncWithArg(343)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
694 ScriptFuncNew()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
695 s:ScriptFuncNew()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 UserFunc()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
697 UserFuncWithArg("foo")
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
698 var FuncRef = function("UserFunc")
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
699 FuncRef()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
700 var FuncRefWithArg = function("UserFuncWithArg")
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
701 FuncRefWithArg("bar")
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
702 return "yes"
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
705 def Test_disassemble_call()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
706 var res = execute('disass s:ScriptFuncCall')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
707 assert_match('<SNR>\d\+_ScriptFuncCall\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
708 'changenr()\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
709 '\d BCALL changenr(argc 0)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
710 '\d DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
711 'char2nr("abc")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
712 '\d PUSHS "abc"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
713 '\d BCALL char2nr(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
714 '\d DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
715 'Test_disassemble_new()\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
716 '\d DCALL Test_disassemble_new(argc 0)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
717 '\d DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
718 'FuncWithArg(343)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
719 '\d\+ PUSHNR 343\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
720 '\d\+ DCALL FuncWithArg(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
721 '\d\+ DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
722 'ScriptFuncNew()\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
723 '\d\+ DCALL <SNR>\d\+_ScriptFuncNew(argc 0)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
724 '\d\+ DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
725 's:ScriptFuncNew()\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
726 '\d\+ DCALL <SNR>\d\+_ScriptFuncNew(argc 0)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
727 '\d\+ DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
728 'UserFunc()\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
729 '\d\+ UCALL UserFunc(argc 0)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
730 '\d\+ DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
731 'UserFuncWithArg("foo")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
732 '\d\+ PUSHS "foo"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
733 '\d\+ UCALL UserFuncWithArg(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
734 '\d\+ DROP\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
735 'var FuncRef = function("UserFunc")\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
736 '\d\+ PUSHS "UserFunc"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
737 '\d\+ BCALL function(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
738 '\d\+ STORE $0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
739 'FuncRef()\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
740 '\d\+ LOAD $\d\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
741 '\d\+ PCALL (argc 0)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
742 '\d\+ DROP\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
743 'var FuncRefWithArg = function("UserFuncWithArg")\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
744 '\d\+ PUSHS "UserFuncWithArg"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
745 '\d\+ BCALL function(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
746 '\d\+ STORE $1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
747 'FuncRefWithArg("bar")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
748 '\d\+ PUSHS "bar"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
749 '\d\+ LOAD $\d\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
750 '\d\+ PCALL (argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
751 '\d\+ DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
752 'return "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
753 '\d\+ PUSHS "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
754 '\d\+ RETURN',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
755 res)
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
756 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
757
22541
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
758
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
759 def s:CreateRefs()
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
760 var local = 'a'
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
761 def Append(arg: string)
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
762 local ..= arg
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
763 enddef
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
764 g:Append = Append
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
765 def Get(): string
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
766 return local
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
767 enddef
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
768 g:Get = Get
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
769 enddef
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
770
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
771 def Test_disassemble_closure()
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
772 CreateRefs()
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
773 var res = execute('disass g:Append')
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
774 assert_match('<lambda>\d\_s*' ..
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
775 'local ..= arg\_s*' ..
23557
f50ee1ae4d9b patch 8.2.2321: Vim9: cannot nest closures
Bram Moolenaar <Bram@vim.org>
parents: 23543
diff changeset
776 '\d LOADOUTER level 1 $0\_s*' ..
22541
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
777 '\d LOAD arg\[-1\]\_s*' ..
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
778 '\d CONCAT\_s*' ..
23557
f50ee1ae4d9b patch 8.2.2321: Vim9: cannot nest closures
Bram Moolenaar <Bram@vim.org>
parents: 23543
diff changeset
779 '\d STOREOUTER level 1 $0\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
780 '\d RETURN void',
22541
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
781 res)
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
782
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
783 res = execute('disass g:Get')
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
784 assert_match('<lambda>\d\_s*' ..
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
785 'return local\_s*' ..
23557
f50ee1ae4d9b patch 8.2.2321: Vim9: cannot nest closures
Bram Moolenaar <Bram@vim.org>
parents: 23543
diff changeset
786 '\d LOADOUTER level 1 $0\_s*' ..
22541
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
787 '\d RETURN',
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
788 res)
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
789
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
790 unlet g:Append
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
791 unlet g:Get
7d6ba4204f66 patch 8.2.1819: Vim9: Memory leak when using a closure
Bram Moolenaar <Bram@vim.org>
parents: 22533
diff changeset
792 enddef
20295
bc2c9ea94ec1 patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
793
19483
0d3dcb4476ba patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents: 19439
diff changeset
794
19862
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
795 def EchoArg(arg: string): string
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
796 return arg
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
797 enddef
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
798 def RefThis(): func
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
799 return function('EchoArg')
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
800 enddef
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
801 def s:ScriptPCall()
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
802 RefThis()("text")
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
803 enddef
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
804
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
805 def Test_disassemble_pcall()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
806 var res = execute('disass s:ScriptPCall')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
807 assert_match('<SNR>\d\+_ScriptPCall\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
808 'RefThis()("text")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
809 '\d DCALL RefThis(argc 0)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
810 '\d PUSHS "text"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
811 '\d PCALL top (argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
812 '\d PCALL end\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
813 '\d DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
814 '\d RETURN void',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
815 res)
19862
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
816 enddef
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
817
846fbbacce3a patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19703
diff changeset
818
20079
336483164ca6 patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents: 20029
diff changeset
819 def s:FuncWithForwardCall(): string
336483164ca6 patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents: 20029
diff changeset
820 return g:DefinedLater("yes")
19532
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
821 enddef
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
822
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
823 def DefinedLater(arg: string): string
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
824 return arg
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
825 enddef
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
826
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
827 def Test_disassemble_update_instr()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
828 var res = execute('disass s:FuncWithForwardCall')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
829 assert_match('FuncWithForwardCall\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
830 'return g:DefinedLater("yes")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
831 '\d PUSHS "yes"\_s*' ..
20528
489cb75c76b6 patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 20407
diff changeset
832 '\d DCALL DefinedLater(argc 1)\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
833 '\d RETURN',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
834 res)
19532
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
835
21353
fb8c8fcb7b60 patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents: 21299
diff changeset
836 # Calling the function will change UCALL into the faster DCALL
19532
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
837 assert_equal('yes', FuncWithForwardCall())
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
838
20079
336483164ca6 patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents: 20029
diff changeset
839 res = execute('disass s:FuncWithForwardCall')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
840 assert_match('FuncWithForwardCall\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
841 'return g:DefinedLater("yes")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
842 '\d PUSHS "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
843 '\d DCALL DefinedLater(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
844 '\d RETURN',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
845 res)
19532
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
846 enddef
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
847
b8f778dda1a1 patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents: 19528
diff changeset
848
24504
e7577f79d6eb patch 8.2.2792: Vim9: :disas shows instructions for default args but no text
Bram Moolenaar <Bram@vim.org>
parents: 24490
diff changeset
849 def FuncWithDefault(l: number, arg: string = "default", nr = 77): string
24272
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
850 return arg .. nr
19483
0d3dcb4476ba patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents: 19439
diff changeset
851 enddef
0d3dcb4476ba patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents: 19439
diff changeset
852
0d3dcb4476ba patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents: 19439
diff changeset
853 def Test_disassemble_call_default()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
854 var res = execute('disass FuncWithDefault')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
855 assert_match('FuncWithDefault\_s*' ..
24504
e7577f79d6eb patch 8.2.2792: Vim9: :disas shows instructions for default args but no text
Bram Moolenaar <Bram@vim.org>
parents: 24490
diff changeset
856 ' arg = "default"\_s*' ..
24272
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
857 '\d JUMP_IF_ARG_SET arg\[-2\] -> 3\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
858 '\d PUSHS "default"\_s*' ..
24272
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
859 '\d STORE arg\[-2]\_s*' ..
24504
e7577f79d6eb patch 8.2.2792: Vim9: :disas shows instructions for default args but no text
Bram Moolenaar <Bram@vim.org>
parents: 24490
diff changeset
860 ' nr = 77\_s*' ..
24272
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
861 '3 JUMP_IF_ARG_SET arg\[-1\] -> 6\_s*' ..
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
862 '\d PUSHNR 77\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
863 '\d STORE arg\[-1]\_s*' ..
24504
e7577f79d6eb patch 8.2.2792: Vim9: :disas shows instructions for default args but no text
Bram Moolenaar <Bram@vim.org>
parents: 24490
diff changeset
864 ' return arg .. nr\_s*' ..
24272
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
865 '6 LOAD arg\[-2]\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
866 '\d LOAD arg\[-1]\_s*' ..
24272
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
867 '\d 2STRING stack\[-1]\_s*' ..
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
868 '\d\+ CONCAT\_s*' ..
cabed216cc2f patch 8.2.2677: Vim9: cannot use only some of the default arguments
Bram Moolenaar <Bram@vim.org>
parents: 24234
diff changeset
869 '\d\+ RETURN',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
870 res)
19483
0d3dcb4476ba patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents: 19439
diff changeset
871 enddef
0d3dcb4476ba patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents: 19439
diff changeset
872
0d3dcb4476ba patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents: 19439
diff changeset
873
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
874 def HasEval()
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
875 if has("eval")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
876 echo "yes"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
877 else
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
878 echo "no"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
879 endif
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
880 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
881
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
882 def HasNothing()
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
883 if has("nothing")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
884 echo "yes"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
885 else
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
886 echo "no"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
887 endif
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
888 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
889
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
890 def HasSomething()
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
891 if has("nothing")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
892 echo "nothing"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
893 elseif has("something")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
894 echo "something"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
895 elseif has("eval")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
896 echo "eval"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
897 elseif has("less")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
898 echo "less"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
899 endif
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
900 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
901
22842
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
902 def HasGuiRunning()
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
903 if has("gui_running")
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
904 echo "yes"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
905 else
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
906 echo "no"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
907 endif
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
908 enddef
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
909
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
910 def Test_disassemble_const_expr()
22147
d55008685870 patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents: 21833
diff changeset
911 assert_equal("\nyes", execute('HasEval()'))
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
912 var instr = execute('disassemble HasEval')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
913 assert_match('HasEval\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
914 'if has("eval")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
915 'echo "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
916 '\d PUSHS "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
917 '\d ECHO 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
918 'else\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
919 'echo "no"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
920 'endif\_s*',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
921 instr)
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
922 assert_notmatch('JUMP', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
923
22147
d55008685870 patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents: 21833
diff changeset
924 assert_equal("\nno", execute('HasNothing()'))
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
925 instr = execute('disassemble HasNothing')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
926 assert_match('HasNothing\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
927 'if has("nothing")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
928 'echo "yes"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
929 'else\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
930 'echo "no"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
931 '\d PUSHS "no"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
932 '\d ECHO 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
933 'endif',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
934 instr)
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
935 assert_notmatch('PUSHS "yes"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
936 assert_notmatch('JUMP', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
937
22147
d55008685870 patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents: 21833
diff changeset
938 assert_equal("\neval", execute('HasSomething()'))
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
939 instr = execute('disassemble HasSomething')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
940 assert_match('HasSomething.*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
941 'if has("nothing")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
942 'echo "nothing"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
943 'elseif has("something")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
944 'echo "something"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
945 'elseif has("eval")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
946 'echo "eval"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
947 '\d PUSHS "eval"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
948 '\d ECHO 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
949 'elseif has("less").*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
950 'echo "less"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
951 'endif',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
952 instr)
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
953 assert_notmatch('PUSHS "nothing"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
954 assert_notmatch('PUSHS "something"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
955 assert_notmatch('PUSHS "less"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
956 assert_notmatch('JUMP', instr)
22842
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
957
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
958 var result: string
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
959 var instr_expected: string
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
960 if has('gui')
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
961 if has('gui_running')
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
962 # GUI already running, always returns "yes"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
963 result = "\nyes"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
964 instr_expected = 'HasGuiRunning.*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
965 'if has("gui_running")\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
966 ' echo "yes"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
967 '\d PUSHS "yes"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
968 '\d ECHO 1\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
969 'else\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
970 ' echo "no"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
971 'endif'
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
972 else
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
973 result = "\nno"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
974 if has('unix')
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
975 # GUI not running but can start later, call has()
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
976 instr_expected = 'HasGuiRunning.*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
977 'if has("gui_running")\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
978 '\d PUSHS "gui_running"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
979 '\d BCALL has(argc 1)\_s*' ..
24430
fe71212fd202 patch 8.2.2755: Vim9: no error for using a number in a condition
Bram Moolenaar <Bram@vim.org>
parents: 24272
diff changeset
980 '\d COND2BOOL\_s*' ..
22842
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
981 '\d JUMP_IF_FALSE -> \d\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
982 ' echo "yes"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
983 '\d PUSHS "yes"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
984 '\d ECHO 1\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
985 'else\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
986 '\d JUMP -> \d\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
987 ' echo "no"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
988 '\d PUSHS "no"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
989 '\d ECHO 1\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
990 'endif'
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
991 else
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
992 # GUI not running, always return "no"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
993 instr_expected = 'HasGuiRunning.*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
994 'if has("gui_running")\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
995 ' echo "yes"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
996 'else\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
997 ' echo "no"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
998 '\d PUSHS "no"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
999 '\d ECHO 1\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1000 'endif'
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1001 endif
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1002 endif
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1003 else
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1004 # GUI not supported, always return "no"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1005 result = "\nno"
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1006 instr_expected = 'HasGuiRunning.*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1007 'if has("gui_running")\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1008 ' echo "yes"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1009 'else\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1010 ' echo "no"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1011 '\d PUSHS "no"\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1012 '\d ECHO 1\_s*' ..
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1013 'endif'
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1014 endif
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1015
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1016 assert_equal(result, execute('HasGuiRunning()'))
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1017 instr = execute('disassemble HasGuiRunning')
f2fbbb72ff28 patch 8.2.1968: Vim9: has() assumes a feature does not change dynamically
Bram Moolenaar <Bram@vim.org>
parents: 22816
diff changeset
1018 assert_match(instr_expected, instr)
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
1019 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
1020
20909
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1021 def ReturnInIf(): string
22926
edfbb06cd0ee patch 8.2.2010: Vim9: compiling fails for unreachable return statement
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
1022 if 1 < 0
edfbb06cd0ee patch 8.2.2010: Vim9: compiling fails for unreachable return statement
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
1023 return "maybe"
edfbb06cd0ee patch 8.2.2010: Vim9: compiling fails for unreachable return statement
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
1024 endif
20909
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1025 if g:cond
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1026 return "yes"
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1027 else
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1028 return "no"
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1029 endif
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1030 enddef
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1031
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1032 def Test_disassemble_return_in_if()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1033 var instr = execute('disassemble ReturnInIf')
20909
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1034 assert_match('ReturnInIf\_s*' ..
22926
edfbb06cd0ee patch 8.2.2010: Vim9: compiling fails for unreachable return statement
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
1035 'if 1 < 0\_s*' ..
edfbb06cd0ee patch 8.2.2010: Vim9: compiling fails for unreachable return statement
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
1036 ' return "maybe"\_s*' ..
edfbb06cd0ee patch 8.2.2010: Vim9: compiling fails for unreachable return statement
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
1037 'endif\_s*' ..
20909
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1038 'if g:cond\_s*' ..
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1039 '0 LOADG g:cond\_s*' ..
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22842
diff changeset
1040 '1 COND2BOOL\_s*' ..
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22842
diff changeset
1041 '2 JUMP_IF_FALSE -> 5\_s*' ..
20909
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1042 'return "yes"\_s*' ..
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22842
diff changeset
1043 '3 PUSHS "yes"\_s*' ..
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22842
diff changeset
1044 '4 RETURN\_s*' ..
20909
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1045 'else\_s*' ..
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1046 ' return "no"\_s*' ..
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22842
diff changeset
1047 '5 PUSHS "no"\_s*' ..
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22842
diff changeset
1048 '6 RETURN$',
20909
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1049 instr)
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1050 enddef
0d7465881b06 patch 8.2.1006: Vim9: require unnecessary return statement
Bram Moolenaar <Bram@vim.org>
parents: 20528
diff changeset
1051
19572
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1052 def WithFunc()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1053 var Funky1: func
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1054 var Funky2: func = function("len")
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1055 var Party2: func = funcref("UserFunc")
19572
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1056 enddef
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1057
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1058 def Test_disassemble_function()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1059 var instr = execute('disassemble WithFunc')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1060 assert_match('WithFunc\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1061 'var Funky1: func\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1062 '0 PUSHFUNC "\[none]"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1063 '1 STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1064 'var Funky2: func = function("len")\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1065 '2 PUSHS "len"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1066 '3 BCALL function(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1067 '4 STORE $1\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1068 'var Party2: func = funcref("UserFunc")\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1069 '\d PUSHS "UserFunc"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1070 '\d BCALL funcref(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1071 '\d STORE $2\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1072 '\d RETURN void',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1073 instr)
19572
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1074 enddef
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1075
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1076 if has('channel')
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1077 def WithChannel()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1078 var job1: job
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1079 var job2: job = job_start("donothing")
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1080 var chan1: channel
19572
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1081 enddef
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1082 endif
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1083
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1084 def Test_disassemble_channel()
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1085 CheckFeature channel
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1086
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1087 var instr = execute('disassemble WithChannel')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1088 assert_match('WithChannel\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1089 'var job1: job\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1090 '\d PUSHJOB "no process"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1091 '\d STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1092 'var job2: job = job_start("donothing")\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1093 '\d PUSHS "donothing"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1094 '\d BCALL job_start(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1095 '\d STORE $1\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1096 'var chan1: channel\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1097 '\d PUSHCHANNEL 0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1098 '\d STORE $2\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1099 '\d RETURN void',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1100 instr)
19572
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1101 enddef
6b6e97d0185e patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents: 19532
diff changeset
1102
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1103 def WithLambda(): string
23428
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1104 var F = (a) => "X" .. a .. "X"
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1105 return F("x")
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1106 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1107
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1108 def Test_disassemble_lambda()
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1109 assert_equal("XxX", WithLambda())
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1110 var instr = execute('disassemble WithLambda')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1111 assert_match('WithLambda\_s*' ..
23428
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1112 'var F = (a) => "X" .. a .. "X"\_s*' ..
22371
15003353a464 patch 8.2.1734: Vim9: cannot use a funcref for a closure twice
Bram Moolenaar <Bram@vim.org>
parents: 22284
diff changeset
1113 '\d FUNCREF <lambda>\d\+\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1114 '\d STORE $0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1115 'return F("x")\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1116 '\d PUSHS "x"\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1117 '\d LOAD $0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1118 '\d PCALL (argc 1)\_s*' ..
20528
489cb75c76b6 patch 8.2.0818: Vim9: using a discovery phase doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 20407
diff changeset
1119 '\d RETURN',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1120 instr)
21299
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1121
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1122 var name = substitute(instr, '.*\(<lambda>\d\+\).*', '\1', '')
21299
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1123 instr = execute('disassemble ' .. name)
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1124 assert_match('<lambda>\d\+\_s*' ..
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1125 'return "X" .. a .. "X"\_s*' ..
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1126 '\d PUSHS "X"\_s*' ..
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1127 '\d LOAD arg\[-1\]\_s*' ..
21771
fcf978444298 patch 8.2.1435: Vim9: always converting to string for ".." leads to mistakes
Bram Moolenaar <Bram@vim.org>
parents: 21755
diff changeset
1128 '\d 2STRING_ANY stack\[-1\]\_s*' ..
21299
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1129 '\d CONCAT\_s*' ..
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1130 '\d PUSHS "X"\_s*' ..
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1131 '\d CONCAT\_s*' ..
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1132 '\d RETURN',
883315e762b7 patch 8.2.1200: Vim9: cannot disassemble a lambda function
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1133 instr)
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1134 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1135
22816
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1136 def LambdaWithType(): number
23428
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1137 var Ref = (a: number) => a + 10
22816
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1138 return Ref(g:value)
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1139 enddef
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1140
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1141 def Test_disassemble_lambda_with_type()
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1142 g:value = 5
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1143 assert_equal(15, LambdaWithType())
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1144 var instr = execute('disassemble LambdaWithType')
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1145 assert_match('LambdaWithType\_s*' ..
23428
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1146 'var Ref = (a: number) => a + 10\_s*' ..
22816
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1147 '\d FUNCREF <lambda>\d\+\_s*' ..
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1148 '\d STORE $0\_s*' ..
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1149 'return Ref(g:value)\_s*' ..
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1150 '\d LOADG g:value\_s*' ..
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1151 '\d LOAD $0\_s*' ..
23691
0d56d4f107d8 patch 8.2.2387: runtime type check does not mention argument index
Bram Moolenaar <Bram@vim.org>
parents: 23654
diff changeset
1152 '\d CHECKTYPE number stack\[-2\] arg 1\_s*' ..
22816
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1153 '\d PCALL (argc 1)\_s*' ..
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1154 '\d RETURN',
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1155 instr)
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1156 enddef
8a5369f5f2b4 patch 8.2.1956: Vim9: cannot specify argument types for lambda
Bram Moolenaar <Bram@vim.org>
parents: 22703
diff changeset
1157
21558
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1158 def NestedOuter()
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1159 def g:Inner()
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1160 echomsg "inner"
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1161 enddef
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1162 enddef
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1163
24152
c308076e225e patch 8.2.2617: Vim9: script variable in block not found by function
Bram Moolenaar <Bram@vim.org>
parents: 23994
diff changeset
1164 def Test_disassemble_nested_func()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1165 var instr = execute('disassemble NestedOuter')
21558
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1166 assert_match('NestedOuter\_s*' ..
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1167 'def g:Inner()\_s*' ..
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1168 'echomsg "inner"\_s*' ..
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1169 'enddef\_s*' ..
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1170 '\d NEWFUNC <lambda>\d\+ Inner\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1171 '\d RETURN void',
21558
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1172 instr)
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1173 enddef
1c4d4aa22b37 patch 8.2.1329: Vim9: cannot define global function inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21399
diff changeset
1174
22973
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1175 def NestedDefList()
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1176 def
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1177 def Info
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1178 def /Info
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1179 def /Info/
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1180 enddef
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1181
24152
c308076e225e patch 8.2.2617: Vim9: script variable in block not found by function
Bram Moolenaar <Bram@vim.org>
parents: 23994
diff changeset
1182 def Test_disassemble_nested_def_list()
22973
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1183 var instr = execute('disassemble NestedDefList')
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1184 assert_match('NestedDefList\_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1185 'def\_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1186 '\d DEF \_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1187 'def Info\_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1188 '\d DEF Info\_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1189 'def /Info\_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1190 '\d DEF /Info\_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1191 'def /Info/\_s*' ..
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1192 '\d DEF /Info/\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1193 '\d RETURN void',
22973
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1194 instr)
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1195 enddef
4c97c0747017 patch 8.2.2033: Vim9: :def without argument gives compilation error
Bram Moolenaar <Bram@vim.org>
parents: 22926
diff changeset
1196
20029
8fb1cf4c44d5 patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents: 20019
diff changeset
1197 def AndOr(arg: any): string
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1198 if arg == 1 && arg != 2 || arg == 4
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1199 return 'yes'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1200 endif
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1201 return 'no'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1202 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1203
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1204 def Test_disassemble_and_or()
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1205 assert_equal("yes", AndOr(1))
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1206 assert_equal("no", AndOr(2))
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1207 assert_equal("yes", AndOr(4))
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1208 var instr = execute('disassemble AndOr')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1209 assert_match('AndOr\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1210 'if arg == 1 && arg != 2 || arg == 4\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1211 '\d LOAD arg\[-1]\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1212 '\d PUSHNR 1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1213 '\d COMPAREANY ==\_s*' ..
22494
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22492
diff changeset
1214 '\d JUMP_IF_COND_FALSE -> \d\+\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1215 '\d LOAD arg\[-1]\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1216 '\d PUSHNR 2\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1217 '\d COMPAREANY !=\_s*' ..
22494
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22492
diff changeset
1218 '\d JUMP_IF_COND_TRUE -> \d\+\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1219 '\d LOAD arg\[-1]\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1220 '\d\+ PUSHNR 4\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1221 '\d\+ COMPAREANY ==\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1222 '\d\+ JUMP_IF_FALSE -> \d\+',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1223 instr)
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1224 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
1225
25814
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1226 def AndConstant(arg: any): string
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1227 if true && arg
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1228 return "yes"
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1229 endif
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1230 if false && arg
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1231 return "never"
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1232 endif
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1233 return "no"
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1234 enddef
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1235
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1236 def Test_disassemble_and_constant()
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1237 assert_equal("yes", AndConstant(1))
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1238 assert_equal("no", AndConstant(false))
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1239 var instr = execute('disassemble AndConstant')
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1240 assert_match('AndConstant\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1241 'if true && arg\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1242 '0 LOAD arg\[-1\]\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1243 '1 COND2BOOL\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1244 '2 JUMP_IF_FALSE -> 5\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1245 'return "yes"\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1246 '3 PUSHS "yes"\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1247 '4 RETURN\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1248 'endif\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1249 'if false && arg\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1250 'return "never"\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1251 'endif\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1252 'return "no"\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1253 '5 PUSHS "no"\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1254 '6 RETURN',
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1255 instr)
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1256 enddef
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1257
19336
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1258 def ForLoop(): list<number>
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1259 var res: list<number>
19336
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1260 for i in range(3)
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1261 res->add(i)
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1262 endfor
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1263 return res
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1264 enddef
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1265
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1266 def Test_disassemble_for_loop()
19336
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1267 assert_equal([0, 1, 2], ForLoop())
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1268 var instr = execute('disassemble ForLoop')
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1269 assert_match('ForLoop\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1270 'var res: list<number>\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1271 '\d NEWLIST size 0\_s*' ..
23458
d2b1269c2c68 patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents: 23438
diff changeset
1272 '\d SETTYPE list<number>\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1273 '\d STORE $0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1274 'for i in range(3)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1275 '\d STORE -1 in $1\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1276 '\d PUSHNR 3\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1277 '\d BCALL range(argc 1)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1278 '\d FOR $1 -> \d\+\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1279 '\d STORE $2\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1280 'res->add(i)\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1281 '\d LOAD $0\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1282 '\d LOAD $2\_s*' ..
22633
6589dae9696c patch 8.2.1865: Vim9: add() does not check type of argument
Bram Moolenaar <Bram@vim.org>
parents: 22541
diff changeset
1283 '\d\+ LISTAPPEND\_s*' ..
20407
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1284 '\d\+ DROP\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1285 'endfor\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1286 '\d\+ JUMP -> \d\+\_s*' ..
33166d945b54 patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents: 20405
diff changeset
1287 '\d\+ DROP',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1288 instr)
19336
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1289 enddef
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
1290
21188
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1291 def ForLoopEval(): string
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1292 var res = ""
21188
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1293 for str in eval('["one", "two"]')
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1294 res ..= str
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1295 endfor
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1296 return res
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1297 enddef
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1298
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1299 def Test_disassemble_for_loop_eval()
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1300 assert_equal('onetwo', ForLoopEval())
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1301 var instr = execute('disassemble ForLoopEval')
21188
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1302 assert_match('ForLoopEval\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1303 'var res = ""\_s*' ..
21188
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1304 '\d PUSHS ""\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1305 '\d STORE $0\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1306 'for str in eval(''\["one", "two"\]'')\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1307 '\d STORE -1 in $1\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1308 '\d PUSHS "\["one", "two"\]"\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1309 '\d BCALL eval(argc 1)\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1310 '\d FOR $1 -> \d\+\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1311 '\d STORE $2\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1312 'res ..= str\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1313 '\d\+ LOAD $0\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1314 '\d\+ LOAD $2\_s*' ..
25453
21b70bab366c patch 8.2.3263: Vim9: "..=" does not accept same types as the ".." operator
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1315 '\d 2STRING_ANY stack\[-1\]\_s*' ..
21188
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1316 '\d\+ CONCAT\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1317 '\d\+ STORE $0\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1318 'endfor\_s*' ..
24234
7ffc795288dd patch 8.2.2658: :for cannot loop over a string
Bram Moolenaar <Bram@vim.org>
parents: 24222
diff changeset
1319 '\d\+ JUMP -> 5\_s*' ..
21188
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1320 '\d\+ DROP\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1321 'return res\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1322 '\d\+ LOAD $0\_s*' ..
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1323 '\d\+ RETURN',
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1324 instr)
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1325 enddef
d73b6ba20053 patch 8.2.1145: Vim9: "for" only accepts a list at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20945
diff changeset
1326
22975
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1327 def ForLoopUnpack()
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1328 for [x1, x2] 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: 22973
diff changeset
1329 echo x1 x2
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1330 endfor
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1331 enddef
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1332
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1333 def Test_disassemble_for_loop_unpack()
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1334 var instr = execute('disassemble ForLoopUnpack')
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1335 assert_match('ForLoopUnpack\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1336 'for \[x1, x2\] in \[\[1, 2\], \[3, 4\]\]\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1337 '\d\+ STORE -1 in $0\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1338 '\d\+ PUSHNR 1\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1339 '\d\+ PUSHNR 2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1340 '\d\+ NEWLIST size 2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1341 '\d\+ PUSHNR 3\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1342 '\d\+ PUSHNR 4\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1343 '\d\+ NEWLIST size 2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1344 '\d\+ NEWLIST size 2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1345 '\d\+ FOR $0 -> 16\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1346 '\d\+ UNPACK 2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1347 '\d\+ STORE $1\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1348 '\d\+ STORE $2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1349 'echo x1 x2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1350 '\d\+ LOAD $1\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1351 '\d\+ LOAD $2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1352 '\d\+ ECHO 2\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1353 'endfor\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1354 '\d\+ JUMP -> 8\_s*' ..
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1355 '\d\+ DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1356 '\d\+ RETURN void',
22975
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1357 instr)
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1358 enddef
a943b175586a patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Bram Moolenaar <Bram@vim.org>
parents: 22973
diff changeset
1359
23927
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1360 def ForLoopContinue()
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1361 for nr in [1, 2]
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1362 try
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1363 echo "ok"
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1364 try
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1365 echo "deeper"
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1366 catch
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1367 continue
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1368 endtry
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1369 catch
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1370 echo "not ok"
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1371 endtry
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1372 endfor
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1373 enddef
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1374
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1375 def Test_disassemble_for_loop_continue()
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1376 var instr = execute('disassemble ForLoopContinue')
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1377 assert_match('ForLoopContinue\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1378 'for nr in \[1, 2]\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1379 '0 STORE -1 in $0\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1380 '1 PUSHNR 1\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1381 '2 PUSHNR 2\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1382 '3 NEWLIST size 2\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1383 '4 FOR $0 -> 22\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1384 '5 STORE $1\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1385 'try\_s*' ..
23994
3daeb2060f25 patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 23927
diff changeset
1386 '6 TRY catch -> 17, endtry -> 20\_s*' ..
23927
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1387 'echo "ok"\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1388 '7 PUSHS "ok"\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1389 '8 ECHO 1\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1390 'try\_s*' ..
23994
3daeb2060f25 patch 8.2.2539: Vim9: return from finally block causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 23927
diff changeset
1391 '9 TRY catch -> 13, endtry -> 15\_s*' ..
23927
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1392 'echo "deeper"\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1393 '10 PUSHS "deeper"\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1394 '11 ECHO 1\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1395 'catch\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1396 '12 JUMP -> 15\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1397 '13 CATCH\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1398 'continue\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1399 '14 TRY-CONTINUE 2 levels -> 4\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1400 'endtry\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1401 '15 ENDTRY\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1402 'catch\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1403 '16 JUMP -> 20\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1404 '17 CATCH\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1405 'echo "not ok"\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1406 '18 PUSHS "not ok"\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1407 '19 ECHO 1\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1408 'endtry\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1409 '20 ENDTRY\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1410 'endfor\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1411 '21 JUMP -> 4\_s*' ..
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1412 '\d\+ DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1413 '\d\+ RETURN void',
23927
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1414 instr)
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1415 enddef
5e5780e3f75d patch 8.2.2506: Vim9: :continue does not work correctly in a :try block
Bram Moolenaar <Bram@vim.org>
parents: 23723
diff changeset
1416
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1417 let g:number = 42
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1418
21717
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1419 def TypeCast()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1420 var l: list<number> = [23, <number>g:number]
21717
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1421 enddef
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1422
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1423 def Test_disassemble_typecast()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1424 var instr = execute('disassemble TypeCast')
21717
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1425 assert_match('TypeCast.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1426 'var l: list<number> = \[23, <number>g:number\].*' ..
21717
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1427 '\d PUSHNR 23\_s*' ..
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1428 '\d LOADG g:number\_s*' ..
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1429 '\d CHECKTYPE number stack\[-1\]\_s*' ..
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1430 '\d NEWLIST size 2\_s*' ..
23458
d2b1269c2c68 patch 8.2.2272: Vim9: extend() can violate the type of a variable
Bram Moolenaar <Bram@vim.org>
parents: 23438
diff changeset
1431 '\d SETTYPE list<number>\_s*' ..
21717
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1432 '\d STORE $0\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1433 '\d RETURN void\_s*',
21717
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1434 instr)
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1435 enddef
ef3b31d510d2 patch 8.2.1408: Vim9: type casting not supported
Bram Moolenaar <Bram@vim.org>
parents: 21558
diff changeset
1436
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1437 def Computing()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1438 var nr = 3
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1439 var nrres = nr + 7
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1440 nrres = nr - 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1441 nrres = nr * 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1442 nrres = nr / 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1443 nrres = nr % 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1444
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1445 var anyres = g:number + 7
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1446 anyres = g:number - 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1447 anyres = g:number * 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1448 anyres = g:number / 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1449 anyres = g:number % 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1450
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1451 if has('float')
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1452 var fl = 3.0
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1453 var flres = fl + 7.0
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1454 flres = fl - 7.0
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1455 flres = fl * 7.0
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1456 flres = fl / 7.0
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1457 endif
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1458 enddef
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1459
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1460 def Test_disassemble_computing()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1461 var instr = execute('disassemble Computing')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1462 assert_match('Computing.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1463 'var nr = 3.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1464 '\d STORE 3 in $0.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1465 'var nrres = nr + 7.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1466 '\d LOAD $0.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1467 '\d PUSHNR 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1468 '\d OPNR +.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1469 '\d STORE $1.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1470 'nrres = nr - 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1471 '\d OPNR -.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1472 'nrres = nr \* 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1473 '\d OPNR \*.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1474 'nrres = nr / 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1475 '\d OPNR /.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1476 'nrres = nr % 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1477 '\d OPNR %.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1478 'var anyres = g:number + 7.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1479 '\d LOADG g:number.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1480 '\d PUSHNR 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1481 '\d OPANY +.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1482 '\d STORE $2.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1483 'anyres = g:number - 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1484 '\d OPANY -.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1485 'anyres = g:number \* 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1486 '\d OPANY \*.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1487 'anyres = g:number / 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1488 '\d OPANY /.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1489 'anyres = g:number % 7.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1490 '\d OPANY %.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1491 instr)
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1492 if has('float')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1493 assert_match('Computing.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1494 'var fl = 3.0.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1495 '\d PUSHF 3.0.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1496 '\d STORE $3.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1497 'var flres = fl + 7.0.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1498 '\d LOAD $3.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1499 '\d PUSHF 7.0.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1500 '\d OPFLOAT +.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1501 '\d STORE $4.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1502 'flres = fl - 7.0.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1503 '\d OPFLOAT -.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1504 'flres = fl \* 7.0.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1505 '\d OPFLOAT \*.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1506 'flres = fl / 7.0.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1507 '\d OPFLOAT /.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1508 instr)
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1509 endif
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
1510 enddef
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1511
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1512 def AddListBlob()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1513 var reslist = [1, 2] + [3, 4]
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1514 var resblob = 0z1122 + 0z3344
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1515 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1516
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1517 def Test_disassemble_add_list_blob()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1518 var instr = execute('disassemble AddListBlob')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1519 assert_match('AddListBlob.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1520 'var reslist = \[1, 2] + \[3, 4].*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1521 '\d PUSHNR 1.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1522 '\d PUSHNR 2.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1523 '\d NEWLIST size 2.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1524 '\d PUSHNR 3.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1525 '\d PUSHNR 4.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1526 '\d NEWLIST size 2.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1527 '\d ADDLIST.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1528 '\d STORE $.*.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1529 'var resblob = 0z1122 + 0z3344.*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1530 '\d PUSHBLOB 0z1122.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1531 '\d PUSHBLOB 0z3344.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1532 '\d ADDBLOB.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1533 '\d STORE $.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1534 instr)
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1535 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1536
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1537 let g:aa = 'aa'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1538 def ConcatString(): string
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1539 var res = g:aa .. "bb"
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1540 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1541 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1542
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1543 def Test_disassemble_concat()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1544 var instr = execute('disassemble ConcatString')
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1545 assert_match('ConcatString.*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1546 'var res = g:aa .. "bb".*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1547 '\d LOADG g:aa.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1548 '\d PUSHS "bb".*' ..
21771
fcf978444298 patch 8.2.1435: Vim9: always converting to string for ".." leads to mistakes
Bram Moolenaar <Bram@vim.org>
parents: 21755
diff changeset
1549 '\d 2STRING_ANY stack\[-2].*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1550 '\d CONCAT.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1551 '\d STORE $.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1552 instr)
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1553 assert_equal('aabb', ConcatString())
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1554 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1555
21826
ccad66ac6c3e patch 8.2.1462: Vim9: string slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21821
diff changeset
1556 def StringIndex(): string
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1557 var s = "abcd"
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1558 var res = s[1]
21397
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1559 return res
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1560 enddef
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1561
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1562 def Test_disassemble_string_index()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1563 var instr = execute('disassemble StringIndex')
21397
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1564 assert_match('StringIndex\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1565 'var s = "abcd"\_s*' ..
21397
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1566 '\d PUSHS "abcd"\_s*' ..
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1567 '\d STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1568 'var res = s\[1]\_s*' ..
21397
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1569 '\d LOAD $0\_s*' ..
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1570 '\d PUSHNR 1\_s*' ..
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1571 '\d STRINDEX\_s*' ..
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1572 '\d STORE $1\_s*',
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1573 instr)
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1574 assert_equal('b', StringIndex())
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1575 enddef
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1576
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1577 def StringSlice(): string
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1578 var s = "abcd"
23414
9bd3873b13e2 patch 8.2.2250: Vim9: sublist is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23310
diff changeset
1579 var res = s[1 : 8]
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1580 return res
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1581 enddef
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1582
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1583 def Test_disassemble_string_slice()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1584 var instr = execute('disassemble StringSlice')
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1585 assert_match('StringSlice\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1586 'var s = "abcd"\_s*' ..
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1587 '\d PUSHS "abcd"\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1588 '\d STORE $0\_s*' ..
23414
9bd3873b13e2 patch 8.2.2250: Vim9: sublist is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23310
diff changeset
1589 'var res = s\[1 : 8]\_s*' ..
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1590 '\d LOAD $0\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1591 '\d PUSHNR 1\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1592 '\d PUSHNR 8\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1593 '\d STRSLICE\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1594 '\d STORE $1\_s*',
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1595 instr)
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1596 assert_equal('bcd', StringSlice())
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1597 enddef
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1598
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1599 def ListIndex(): number
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1600 var l = [1, 2, 3]
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1601 var res = l[1]
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1602 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1603 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1604
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1605 def Test_disassemble_list_index()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1606 var instr = execute('disassemble ListIndex')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1607 assert_match('ListIndex\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1608 'var l = \[1, 2, 3]\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1609 '\d PUSHNR 1\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1610 '\d PUSHNR 2\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1611 '\d PUSHNR 3\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1612 '\d NEWLIST size 3\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1613 '\d STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1614 'var res = l\[1]\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1615 '\d LOAD $0\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1616 '\d PUSHNR 1\_s*' ..
21397
62339482daab patch 8.2.1249: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 21353
diff changeset
1617 '\d LISTINDEX\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1618 '\d STORE $1\_s*',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1619 instr)
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1620 assert_equal(2, ListIndex())
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1621 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1622
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1623 def ListSlice(): list<number>
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1624 var l = [1, 2, 3]
23414
9bd3873b13e2 patch 8.2.2250: Vim9: sublist is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23310
diff changeset
1625 var res = l[1 : 8]
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1626 return res
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1627 enddef
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1628
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1629 def Test_disassemble_list_slice()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1630 var instr = execute('disassemble ListSlice')
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1631 assert_match('ListSlice\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1632 'var l = \[1, 2, 3]\_s*' ..
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1633 '\d PUSHNR 1\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1634 '\d PUSHNR 2\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1635 '\d PUSHNR 3\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1636 '\d NEWLIST size 3\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1637 '\d STORE $0\_s*' ..
23414
9bd3873b13e2 patch 8.2.2250: Vim9: sublist is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23310
diff changeset
1638 'var res = l\[1 : 8]\_s*' ..
21828
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1639 '\d LOAD $0\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1640 '\d PUSHNR 1\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1641 '\d PUSHNR 8\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1642 '\d LISTSLICE\_s*' ..
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1643 '\d STORE $1\_s*',
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1644 instr)
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1645 assert_equal([2, 3], ListSlice())
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1646 enddef
af5db9b6d210 patch 8.2.1463: Vim9: list slice not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 21826
diff changeset
1647
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1648 def DictMember(): number
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
1649 var d = {item: 1}
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1650 var res = d.item
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1651 res = d["item"]
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1652 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1653 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1654
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1655 def Test_disassemble_dict_member()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1656 var instr = execute('disassemble DictMember')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1657 assert_match('DictMember\_s*' ..
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
1658 'var d = {item: 1}\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1659 '\d PUSHS "item"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1660 '\d PUSHNR 1\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1661 '\d NEWDICT size 1\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1662 '\d STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1663 'var res = d.item\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1664 '\d\+ LOAD $0\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1665 '\d\+ MEMBER item\_s*' ..
25800
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
1666 '\d\+ USEDICT\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1667 '\d\+ STORE $1\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1668 'res = d\["item"\]\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1669 '\d\+ LOAD $0\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1670 '\d\+ PUSHS "item"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1671 '\d\+ MEMBER\_s*' ..
25800
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
1672 '\d\+ USEDICT\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1673 '\d\+ STORE $1\_s*',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1674 instr)
22147
d55008685870 patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents: 21833
diff changeset
1675 assert_equal(1, DictMember())
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1676 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1677
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1678 let somelist = [1, 2, 3, 4, 5]
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1679 def AnyIndex(): number
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1680 var res = g:somelist[2]
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1681 return res
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1682 enddef
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1683
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1684 def Test_disassemble_any_index()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1685 var instr = execute('disassemble AnyIndex')
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1686 assert_match('AnyIndex\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1687 'var res = g:somelist\[2\]\_s*' ..
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1688 '\d LOADG g:somelist\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1689 '\d PUSHNR 2\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1690 '\d ANYINDEX\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1691 '\d STORE $0\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1692 'return res\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1693 '\d LOAD $0\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1694 '\d CHECKTYPE number stack\[-1\]\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1695 '\d RETURN',
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1696 instr)
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1697 assert_equal(3, AnyIndex())
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1698 enddef
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1699
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1700 def AnySlice(): list<number>
23414
9bd3873b13e2 patch 8.2.2250: Vim9: sublist is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23310
diff changeset
1701 var res = g:somelist[1 : 3]
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1702 return res
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1703 enddef
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1704
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1705 def Test_disassemble_any_slice()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1706 var instr = execute('disassemble AnySlice')
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1707 assert_match('AnySlice\_s*' ..
23414
9bd3873b13e2 patch 8.2.2250: Vim9: sublist is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23310
diff changeset
1708 'var res = g:somelist\[1 : 3\]\_s*' ..
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1709 '\d LOADG g:somelist\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1710 '\d PUSHNR 1\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1711 '\d PUSHNR 3\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1712 '\d ANYSLICE\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1713 '\d STORE $0\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1714 'return res\_s*' ..
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1715 '\d LOAD $0\_s*' ..
22284
6b385c2b9ff5 patch 8.2.1691: Vim9: list<any> is not accepted where list<number> is expected
Bram Moolenaar <Bram@vim.org>
parents: 22196
diff changeset
1716 '\d CHECKTYPE list<number> stack\[-1\]\_s*' ..
21833
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1717 '\d RETURN',
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1718 instr)
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1719 assert_equal([2, 3, 4], AnySlice())
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1720 enddef
e3f9528bddda patch 8.2.1466: Vim9: cannot index or slice a variable with type "any"
Bram Moolenaar <Bram@vim.org>
parents: 21828
diff changeset
1721
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1722 def NegateNumber(): number
25634
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1723 g:nr = 9
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1724 var plus = +g:nr
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1725 var minus = -g:nr
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1726 return minus
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1727 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1728
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1729 def Test_disassemble_negate_number()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1730 var instr = execute('disassemble NegateNumber')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1731 assert_match('NegateNumber\_s*' ..
25634
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1732 'g:nr = 9\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1733 '\d PUSHNR 9\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1734 '\d STOREG g:nr\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1735 'var plus = +g:nr\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1736 '\d LOADG g:nr\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1737 '\d CHECKTYPE number stack\[-1\]\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1738 '\d STORE $0\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1739 'var minus = -g:nr\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1740 '\d LOADG g:nr\_s*' ..
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1741 '\d CHECKTYPE number stack\[-1\]\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1742 '\d NEGATENR\_s*' ..
25634
27cb2e79ccde patch 8.2.3353: Vim9: type of argument for negate not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25605
diff changeset
1743 '\d STORE $1\_s*',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1744 instr)
22147
d55008685870 patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents: 21833
diff changeset
1745 assert_equal(-9, NegateNumber())
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1746 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1747
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1748 def InvertBool(): bool
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1749 var flag = true
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1750 var invert = !flag
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1751 var res = !!flag
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1752 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1753 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1754
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1755 def Test_disassemble_invert_bool()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1756 var instr = execute('disassemble InvertBool')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1757 assert_match('InvertBool\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1758 'var flag = true\_s*' ..
23438
4c6ebf531284 patch 8.2.2262: Vim9: converting bool to string prefixes v:
Bram Moolenaar <Bram@vim.org>
parents: 23428
diff changeset
1759 '\d PUSH true\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1760 '\d STORE $0\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1761 'var invert = !flag\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1762 '\d LOAD $0\_s*' ..
24796
7c1375eb1636 patch 8.2.2936: Vim9: converting number to bool uses wrong stack offset
Bram Moolenaar <Bram@vim.org>
parents: 24606
diff changeset
1763 '\d INVERT -1 (!val)\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1764 '\d STORE $1\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1765 'var res = !!flag\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1766 '\d LOAD $0\_s*' ..
24796
7c1375eb1636 patch 8.2.2936: Vim9: converting number to bool uses wrong stack offset
Bram Moolenaar <Bram@vim.org>
parents: 24606
diff changeset
1767 '\d 2BOOL -1 (!!val)\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1768 '\d STORE $2\_s*',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1769 instr)
22147
d55008685870 patch 8.2.1623: Vim9: using :call where it is not needed
Bram Moolenaar <Bram@vim.org>
parents: 21833
diff changeset
1770 assert_equal(true, InvertBool())
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1771 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
1772
22196
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1773 def ReturnBool(): bool
25814
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1774 var one = 1
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1775 var zero = 0
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1776 var name: bool = one && zero || one
22494
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22492
diff changeset
1777 return name
22196
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1778 enddef
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1779
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1780 def Test_disassemble_return_bool()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1781 var instr = execute('disassemble ReturnBool')
22196
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1782 assert_match('ReturnBool\_s*' ..
25814
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1783 'var one = 1\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1784 '0 STORE 1 in $0\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1785 'var zero = 0\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1786 '1 STORE 0 in $1\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1787 'var name: bool = one && zero || one\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1788 '2 LOAD $0\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1789 '3 COND2BOOL\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1790 '4 JUMP_IF_COND_FALSE -> 7\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1791 '5 LOAD $1\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1792 '6 COND2BOOL\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1793 '7 JUMP_IF_COND_TRUE -> 10\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1794 '8 LOAD $0\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1795 '9 COND2BOOL\_s*' ..
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1796 '10 STORE $2\_s*' ..
22494
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22492
diff changeset
1797 'return name\_s*' ..
25814
dd4e86558836 patch 8.2.3442: Vim9: || and && are not handled at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25800
diff changeset
1798 '\d\+ LOAD $2\_s*' ..
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22842
diff changeset
1799 '\d\+ RETURN',
22196
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1800 instr)
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1801 assert_equal(true, InvertBool())
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1802 enddef
d835f2fdfcfc patch 8.2.1647: Vim9: result of expression with && and || is not a bool
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
1803
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1804 def Test_disassemble_compare()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1805 var cases = [
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1806 ['true == isFalse', 'COMPAREBOOL =='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1807 ['true != isFalse', 'COMPAREBOOL !='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1808 ['v:none == isNull', 'COMPARESPECIAL =='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1809 ['v:none != isNull', 'COMPARESPECIAL !='],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1810
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1811 ['111 == aNumber', 'COMPARENR =='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1812 ['111 != aNumber', 'COMPARENR !='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1813 ['111 > aNumber', 'COMPARENR >'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1814 ['111 < aNumber', 'COMPARENR <'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1815 ['111 >= aNumber', 'COMPARENR >='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1816 ['111 <= aNumber', 'COMPARENR <='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1817 ['111 =~ aNumber', 'COMPARENR =\~'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1818 ['111 !~ aNumber', 'COMPARENR !\~'],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1819
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1820 ['"xx" != aString', 'COMPARESTRING !='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1821 ['"xx" > aString', 'COMPARESTRING >'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1822 ['"xx" < aString', 'COMPARESTRING <'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1823 ['"xx" >= aString', 'COMPARESTRING >='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1824 ['"xx" <= aString', 'COMPARESTRING <='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1825 ['"xx" =~ aString', 'COMPARESTRING =\~'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1826 ['"xx" !~ aString', 'COMPARESTRING !\~'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1827 ['"xx" is aString', 'COMPARESTRING is'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1828 ['"xx" isnot aString', 'COMPARESTRING isnot'],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1829
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1830 ['0z11 == aBlob', 'COMPAREBLOB =='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1831 ['0z11 != aBlob', 'COMPAREBLOB !='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1832 ['0z11 is aBlob', 'COMPAREBLOB is'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1833 ['0z11 isnot aBlob', 'COMPAREBLOB isnot'],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1834
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1835 ['[1, 2] == aList', 'COMPARELIST =='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1836 ['[1, 2] != aList', 'COMPARELIST !='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1837 ['[1, 2] is aList', 'COMPARELIST is'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1838 ['[1, 2] isnot aList', 'COMPARELIST isnot'],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1839
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
1840 ['{a: 1} == aDict', 'COMPAREDICT =='],
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
1841 ['{a: 1} != aDict', 'COMPAREDICT !='],
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
1842 ['{a: 1} is aDict', 'COMPAREDICT is'],
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
1843 ['{a: 1} isnot aDict', 'COMPAREDICT isnot'],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1844
23428
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1845 ['(() => 33) == (() => 44)', 'COMPAREFUNC =='],
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1846 ['(() => 33) != (() => 44)', 'COMPAREFUNC !='],
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1847 ['(() => 33) is (() => 44)', 'COMPAREFUNC is'],
5807e3958e38 patch 8.2.2257: Vim9: using -> for lambda is ambiguous
Bram Moolenaar <Bram@vim.org>
parents: 23414
diff changeset
1848 ['(() => 33) isnot (() => 44)', 'COMPAREFUNC isnot'],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1849
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1850 ['77 == g:xx', 'COMPAREANY =='],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1851 ['77 != g:xx', 'COMPAREANY !='],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1852 ['77 > g:xx', 'COMPAREANY >'],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1853 ['77 < g:xx', 'COMPAREANY <'],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1854 ['77 >= g:xx', 'COMPAREANY >='],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1855 ['77 <= g:xx', 'COMPAREANY <='],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1856 ['77 =~ g:xx', 'COMPAREANY =\~'],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1857 ['77 !~ g:xx', 'COMPAREANY !\~'],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1858 ['77 is g:xx', 'COMPAREANY is'],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1859 ['77 isnot g:xx', 'COMPAREANY isnot'],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1860 ]
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1861 var floatDecl = ''
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1862 if has('float')
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1863 cases->extend([
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1864 ['1.1 == aFloat', 'COMPAREFLOAT =='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1865 ['1.1 != aFloat', 'COMPAREFLOAT !='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1866 ['1.1 > aFloat', 'COMPAREFLOAT >'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1867 ['1.1 < aFloat', 'COMPAREFLOAT <'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1868 ['1.1 >= aFloat', 'COMPAREFLOAT >='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1869 ['1.1 <= aFloat', 'COMPAREFLOAT <='],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1870 ['1.1 =~ aFloat', 'COMPAREFLOAT =\~'],
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1871 ['1.1 !~ aFloat', 'COMPAREFLOAT !\~'],
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1872 ])
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1873 floatDecl = 'var aFloat = 2.2'
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1874 endif
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1875
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1876 var nr = 1
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1877 for case in cases
21353
fb8c8fcb7b60 patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents: 21299
diff changeset
1878 # declare local variables to get a non-constant with the right type
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1879 writefile(['def TestCase' .. nr .. '()',
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1880 ' var isFalse = false',
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1881 ' var isNull = v:null',
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1882 ' var aNumber = 222',
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1883 ' var aString = "yy"',
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1884 ' var aBlob = 0z22',
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1885 ' var aList = [3, 4]',
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22975
diff changeset
1886 ' var aDict = {x: 2}',
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1887 floatDecl,
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1888 ' if ' .. case[0],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1889 ' echo 42'
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1890 ' endif',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1891 'enddef'], 'Xdisassemble')
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1892 source Xdisassemble
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1893 var instr = execute('disassemble TestCase' .. nr)
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1894 assert_match('TestCase' .. nr .. '.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1895 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1896 '\d \(PUSH\|FUNCREF\).*' ..
20328
445c2b2ea44b patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20324
diff changeset
1897 '\d \(PUSH\|FUNCREF\|LOAD\).*' ..
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1898 '\d ' .. case[1] .. '.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1899 '\d JUMP_IF_FALSE -> \d\+.*',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1900 instr)
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1901
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1902 nr += 1
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1903 endfor
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1904
19703
f03357f16ffc patch 8.2.0408: delete() commented out for testing
Bram Moolenaar <Bram@vim.org>
parents: 19579
diff changeset
1905 delete('Xdisassemble')
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1906 enddef
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
1907
22492
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1908 def s:FalsyOp()
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1909 echo g:flag ?? "yes"
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1910 echo [] ?? "empty list"
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1911 echo "" ?? "empty string"
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1912 enddef
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1913
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1914 def Test_dsassemble_falsy_op()
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1915 var res = execute('disass s:FalsyOp')
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1916 assert_match('\<SNR>\d*_FalsyOp\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1917 'echo g:flag ?? "yes"\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1918 '0 LOADG g:flag\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1919 '1 JUMP_AND_KEEP_IF_TRUE -> 3\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1920 '2 PUSHS "yes"\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1921 '3 ECHO 1\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1922 'echo \[\] ?? "empty list"\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1923 '4 NEWLIST size 0\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1924 '5 JUMP_AND_KEEP_IF_TRUE -> 7\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1925 '6 PUSHS "empty list"\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1926 '7 ECHO 1\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1927 'echo "" ?? "empty string"\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1928 '\d\+ PUSHS "empty string"\_s*' ..
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1929 '\d\+ ECHO 1\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1930 '\d\+ RETURN void',
22492
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1931 res)
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1932 enddef
0e03ef68e738 patch 8.2.1794: no falsy Coalescing operator
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
1933
19880
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1934 def Test_disassemble_compare_const()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1935 var cases = [
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1936 ['"xx" == "yy"', false],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1937 ['"aa" == "aa"', true],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1938 ['has("eval") ? true : false', true],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1939 ['has("asdf") ? true : false', false],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1940 ]
19880
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1941
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1942 var nr = 1
19880
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1943 for case in cases
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1944 writefile(['def TestCase' .. nr .. '()',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1945 ' if ' .. case[0],
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1946 ' echo 42'
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1947 ' endif',
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1948 'enddef'], 'Xdisassemble')
19880
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1949 source Xdisassemble
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1950 var instr = execute('disassemble TestCase' .. nr)
19880
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1951 if case[1]
21353
fb8c8fcb7b60 patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents: 21299
diff changeset
1952 # condition true, "echo 42" executed
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1953 assert_match('TestCase' .. nr .. '.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1954 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1955 '\d PUSHNR 42.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1956 '\d ECHO 1.*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1957 '\d RETURN void',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1958 instr)
19880
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1959 else
21353
fb8c8fcb7b60 patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents: 21299
diff changeset
1960 # condition false, function just returns
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1961 assert_match('TestCase' .. nr .. '.*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1962 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '[ \n]*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1963 'echo 42[ \n]*' ..
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1964 'endif[ \n]*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
1965 '\d RETURN void',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
1966 instr)
19880
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1967 endif
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1968
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1969 nr += 1
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1970 endfor
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1971
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1972 delete('Xdisassemble')
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1973 enddef
50fa63ca3828 patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 19862
diff changeset
1974
19528
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
1975 def s:Execute()
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
1976 execute 'help vim9.txt'
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1977 var cmd = 'help vim9.txt'
19528
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
1978 execute cmd
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1979 var tag = 'vim9.txt'
19528
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
1980 execute 'help ' .. tag
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
1981 enddef
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
1982
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
1983 def Test_disassemble_execute()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1984 var res = execute('disass s:Execute')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1985 assert_match('\<SNR>\d*_Execute\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1986 "execute 'help vim9.txt'\\_s*" ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1987 '\d PUSHS "help vim9.txt"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1988 '\d EXECUTE 1\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1989 "var cmd = 'help vim9.txt'\\_s*" ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1990 '\d PUSHS "help vim9.txt"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1991 '\d STORE $0\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1992 'execute cmd\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1993 '\d LOAD $0\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1994 '\d EXECUTE 1\_s*' ..
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
1995 "var tag = 'vim9.txt'\\_s*" ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1996 '\d PUSHS "vim9.txt"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1997 '\d STORE $1\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1998 "execute 'help ' .. tag\\_s*" ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
1999 '\d\+ PUSHS "help "\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2000 '\d\+ LOAD $1\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2001 '\d\+ CONCAT\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2002 '\d\+ EXECUTE 1\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
2003 '\d\+ RETURN void',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
2004 res)
19528
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
2005 enddef
3b026343f398 patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents: 19483
diff changeset
2006
26370
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2007 def s:OnlyRange()
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2008 :$
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2009 :123
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2010 :'m
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2011 enddef
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2012
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2013 def Test_disassemble_range_only()
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2014 var res = execute('disass s:OnlyRange')
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2015 assert_match('\<SNR>\d*_OnlyRange\_s*' ..
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2016 ':$\_s*' ..
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2017 '\d EXECRANGE $\_s*' ..
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2018 ':123\_s*' ..
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2019 '\d EXECRANGE 123\_s*' ..
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2020 ':''m\_s*' ..
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2021 '\d EXECRANGE ''m\_s*' ..
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2022 '\d\+ RETURN void',
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2023 res)
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2024 enddef
a3a0885d9dd8 patch 8.2.3716: Vim9: range without a command is not compiled
Bram Moolenaar <Bram@vim.org>
parents: 26352
diff changeset
2025
20142
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2026 def s:Echomsg()
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2027 echomsg 'some' 'message'
25541
2ae1d5a4ae5c patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents: 25461
diff changeset
2028 echoconsole 'nothing'
20142
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2029 echoerr 'went' .. 'wrong'
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2030 enddef
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2031
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2032 def Test_disassemble_echomsg()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
2033 var res = execute('disass s:Echomsg')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2034 assert_match('\<SNR>\d*_Echomsg\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2035 "echomsg 'some' 'message'\\_s*" ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2036 '\d PUSHS "some"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2037 '\d PUSHS "message"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2038 '\d ECHOMSG 2\_s*' ..
25541
2ae1d5a4ae5c patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents: 25461
diff changeset
2039 "echoconsole 'nothing'\\_s*" ..
2ae1d5a4ae5c patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents: 25461
diff changeset
2040 '\d PUSHS "nothing"\_s*' ..
2ae1d5a4ae5c patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Bram Moolenaar <Bram@vim.org>
parents: 25461
diff changeset
2041 '\d ECHOCONSOLE 1\_s*' ..
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2042 "echoerr 'went' .. 'wrong'\\_s*" ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2043 '\d PUSHS "wentwrong"\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2044 '\d ECHOERR 1\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
2045 '\d RETURN void',
20142
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2046 res)
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2047 enddef
fe8d0a4344df patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20099
diff changeset
2048
19579
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2049 def SomeStringArg(arg: string)
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2050 echo arg
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2051 enddef
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2052
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2053 def SomeAnyArg(arg: any)
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2054 echo arg
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2055 enddef
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2056
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2057 def SomeStringArgAndReturn(arg: string): string
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2058 return arg
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2059 enddef
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2060
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2061 def Test_display_func()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
2062 var res1 = execute('function SomeStringArg')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2063 assert_match('.* def SomeStringArg(arg: string)\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2064 '\d *echo arg.*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2065 ' *enddef',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
2066 res1)
19579
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2067
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
2068 var res2 = execute('function SomeAnyArg')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2069 assert_match('.* def SomeAnyArg(arg: any)\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2070 '\d *echo arg\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2071 ' *enddef',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
2072 res2)
19579
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2073
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
2074 var res3 = execute('function SomeStringArgAndReturn')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2075 assert_match('.* def SomeStringArgAndReturn(arg: string): string\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2076 '\d *return arg\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2077 ' *enddef',
20019
e9af5a09a55b patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents: 19912
diff changeset
2078 res3)
19579
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2079 enddef
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 19572
diff changeset
2080
20339
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2081 def Test_vim9script_forward_func()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
2082 var lines =<< trim END
20339
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2083 vim9script
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2084 def FuncOne(): string
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2085 return FuncTwo()
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2086 enddef
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2087 def FuncTwo(): string
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2088 return 'two'
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2089 enddef
20945
0653b9b72091 patch 8.2.1024: Vim9: no error for using "let g:var = val"
Bram Moolenaar <Bram@vim.org>
parents: 20913
diff changeset
2090 g:res_FuncOne = execute('disass FuncOne')
20339
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2091 END
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2092 writefile(lines, 'Xdisassemble')
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2093 source Xdisassemble
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2094
21353
fb8c8fcb7b60 patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Bram Moolenaar <Bram@vim.org>
parents: 21299
diff changeset
2095 # check that the first function calls the second with DCALL
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2096 assert_match('\<SNR>\d*_FuncOne\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2097 'return FuncTwo()\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2098 '\d DCALL <SNR>\d\+_FuncTwo(argc 0)\_s*' ..
20339
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2099 '\d RETURN',
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2100 g:res_FuncOne)
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2101
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2102 delete('Xdisassemble')
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2103 unlet g:res_FuncOne
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2104 enddef
7587d892c00c patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents: 20336
diff changeset
2105
20305
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2106 def s:ConcatStrings(): string
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2107 return 'one' .. 'two' .. 'three'
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2108 enddef
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2109
20324
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2110 def s:ComputeConst(): number
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2111 return 2 + 3 * 4 / 6 + 7
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2112 enddef
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2113
20336
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2114 def s:ComputeConstParen(): number
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2115 return ((2 + 4) * (8 / 2)) / (3 + 4)
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2116 enddef
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2117
20305
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2118 def Test_simplify_const_expr()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
2119 var res = execute('disass s:ConcatStrings')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2120 assert_match('<SNR>\d*_ConcatStrings\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2121 "return 'one' .. 'two' .. 'three'\\_s*" ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2122 '\d PUSHS "onetwothree"\_s*' ..
20305
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2123 '\d RETURN',
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2124 res)
20324
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2125
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2126 res = execute('disass s:ComputeConst')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2127 assert_match('<SNR>\d*_ComputeConst\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2128 'return 2 + 3 \* 4 / 6 + 7\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2129 '\d PUSHNR 11\_s*' ..
20324
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2130 '\d RETURN',
23188ef99fc2 patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents: 20305
diff changeset
2131 res)
20336
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2132
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2133 res = execute('disass s:ComputeConstParen')
20405
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2134 assert_match('<SNR>\d*_ComputeConstParen\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2135 'return ((2 + 4) \* (8 / 2)) / (3 + 4)\_s*' ..
83573e907c8b patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents: 20397
diff changeset
2136 '\d PUSHNR 3\>\_s*' ..
20336
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2137 '\d RETURN',
2fd980fb9ab3 patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents: 20328
diff changeset
2138 res)
20305
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2139 enddef
9a5e2370df0e patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents: 20301
diff changeset
2140
21232
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2141 def s:CallAppend()
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2142 eval "some text"->append(2)
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2143 enddef
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2144
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2145 def Test_shuffle()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22371
diff changeset
2146 var res = execute('disass s:CallAppend')
21232
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2147 assert_match('<SNR>\d*_CallAppend\_s*' ..
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2148 'eval "some text"->append(2)\_s*' ..
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2149 '\d PUSHS "some text"\_s*' ..
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2150 '\d PUSHNR 2\_s*' ..
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2151 '\d SHUFFLE 2 up 1\_s*' ..
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2152 '\d BCALL append(argc 2)\_s*' ..
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2153 '\d DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
2154 '\d RETURN void',
21232
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2155 res)
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2156 enddef
3f14e0d4a4dd patch 8.2.1167: Vim9: builtin function method call only supports first arg
Bram Moolenaar <Bram@vim.org>
parents: 21188
diff changeset
2157
22691
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2158
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2159 def s:SilentMessage()
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2160 silent echomsg "text"
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2161 silent! echoerr "error"
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2162 enddef
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2163
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2164 def Test_silent()
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2165 var res = execute('disass s:SilentMessage')
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2166 assert_match('<SNR>\d*_SilentMessage\_s*' ..
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2167 'silent echomsg "text"\_s*' ..
22703
f2bfee4ac356 patch 8.2.1900: Vim9: command modifiers do not work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
2168 '\d CMDMOD silent\_s*' ..
22691
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2169 '\d PUSHS "text"\_s*' ..
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2170 '\d ECHOMSG 1\_s*' ..
22703
f2bfee4ac356 patch 8.2.1900: Vim9: command modifiers do not work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
2171 '\d CMDMOD_REV\_s*' ..
22691
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2172 'silent! echoerr "error"\_s*' ..
22703
f2bfee4ac356 patch 8.2.1900: Vim9: command modifiers do not work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
2173 '\d CMDMOD silent!\_s*' ..
22691
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2174 '\d PUSHS "error"\_s*' ..
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2175 '\d ECHOERR 1\_s*' ..
22703
f2bfee4ac356 patch 8.2.1900: Vim9: command modifiers do not work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
2176 '\d CMDMOD_REV\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
2177 '\d\+ RETURN void',
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2178 res)
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2179 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2180
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2181 def s:SilentIf()
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2182 silent if 4 == g:five
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2183 silent elseif 4 == g:five
24222
a2e6029d354e patch 8.2.2652: Vim9: can use command modifier without an effect
Bram Moolenaar <Bram@vim.org>
parents: 24220
diff changeset
2184 endif
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2185 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2186
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2187 def Test_silent_if()
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2188 var res = execute('disass s:SilentIf')
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2189 assert_match('<SNR>\d*_SilentIf\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2190 'silent if 4 == g:five\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2191 '\d\+ CMDMOD silent\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2192 '\d\+ PUSHNR 4\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2193 '\d\+ LOADG g:five\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2194 '\d\+ COMPAREANY ==\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2195 '\d\+ CMDMOD_REV\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2196 '\d\+ JUMP_IF_FALSE -> \d\+\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2197 'silent elseif 4 == g:five\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2198 '\d\+ JUMP -> \d\+\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2199 '\d\+ CMDMOD silent\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2200 '\d\+ PUSHNR 4\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2201 '\d\+ LOADG g:five\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2202 '\d\+ COMPAREANY ==\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2203 '\d\+ CMDMOD_REV\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2204 '\d\+ JUMP_IF_FALSE -> \d\+\_s*' ..
24222
a2e6029d354e patch 8.2.2652: Vim9: can use command modifier without an effect
Bram Moolenaar <Bram@vim.org>
parents: 24220
diff changeset
2205 'endif\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
2206 '\d\+ RETURN void',
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2207 res)
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2208 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2209
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2210 def s:SilentFor()
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2211 silent for i in [0]
24222
a2e6029d354e patch 8.2.2652: Vim9: can use command modifier without an effect
Bram Moolenaar <Bram@vim.org>
parents: 24220
diff changeset
2212 endfor
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2213 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2214
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2215 def Test_silent_for()
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2216 var res = execute('disass s:SilentFor')
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2217 assert_match('<SNR>\d*_SilentFor\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2218 'silent for i in \[0\]\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2219 '\d CMDMOD silent\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2220 '\d STORE -1 in $0\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2221 '\d PUSHNR 0\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2222 '\d NEWLIST size 1\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2223 '\d CMDMOD_REV\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2224 '5 FOR $0 -> 8\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2225 '\d STORE $1\_s*' ..
24222
a2e6029d354e patch 8.2.2652: Vim9: can use command modifier without an effect
Bram Moolenaar <Bram@vim.org>
parents: 24220
diff changeset
2226 'endfor\_s*' ..
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2227 '\d JUMP -> 5\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2228 '8 DROP\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
2229 '\d RETURN void\_s*',
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2230 res)
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2231 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2232
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2233 def s:SilentWhile()
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2234 silent while g:not
24222
a2e6029d354e patch 8.2.2652: Vim9: can use command modifier without an effect
Bram Moolenaar <Bram@vim.org>
parents: 24220
diff changeset
2235 endwhile
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2236 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2237
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2238 def Test_silent_while()
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2239 var res = execute('disass s:SilentWhile')
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2240 assert_match('<SNR>\d*_SilentWhile\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2241 'silent while g:not\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2242 '0 CMDMOD silent\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2243 '\d LOADG g:not\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2244 '\d COND2BOOL\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2245 '\d CMDMOD_REV\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2246 '\d JUMP_IF_FALSE -> 6\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2247
24222
a2e6029d354e patch 8.2.2652: Vim9: can use command modifier without an effect
Bram Moolenaar <Bram@vim.org>
parents: 24220
diff changeset
2248 'endwhile\_s*' ..
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2249 '\d JUMP -> 0\_s*' ..
24936
345619f35112 patch 8.2.3005: Vim9: using a void value does not give a proper error message
Bram Moolenaar <Bram@vim.org>
parents: 24920
diff changeset
2250 '6 RETURN void\_s*',
24220
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2251 res)
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2252 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2253
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2254 def s:SilentReturn(): string
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2255 silent return "done"
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2256 enddef
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2257
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2258 def Test_silent_return()
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2259 var res = execute('disass s:SilentReturn')
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2260 assert_match('<SNR>\d*_SilentReturn\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2261 'silent return "done"\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2262 '\d CMDMOD silent\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2263 '\d PUSHS "done"\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2264 '\d CMDMOD_REV\_s*' ..
a7a9176bb542 patch 8.2.2651: Vim9: restoring command modifiers happens after jump
Bram Moolenaar <Bram@vim.org>
parents: 24152
diff changeset
2265 '\d RETURN',
22691
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2266 res)
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2267 enddef
dda110a14be4 patch 8.2.1894: Vim9: command modifiers are not supported
Bram Moolenaar <Bram@vim.org>
parents: 22637
diff changeset
2268
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2269 def s:Profiled(): string
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2270 # comment
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2271 echo "profiled"
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2272 # comment
24920
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2273 var some = "some text"
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2274 return "done"
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2275 enddef
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2276
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2277 def Test_profiled()
23719
1a7c2685d780 patch 8.2.2401: build fails without +profiling feature
Bram Moolenaar <Bram@vim.org>
parents: 23717
diff changeset
2278 if !has('profile')
1a7c2685d780 patch 8.2.2401: build fails without +profiling feature
Bram Moolenaar <Bram@vim.org>
parents: 23717
diff changeset
2279 MissingFeature 'profile'
1a7c2685d780 patch 8.2.2401: build fails without +profiling feature
Bram Moolenaar <Bram@vim.org>
parents: 23717
diff changeset
2280 endif
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2281 var res = execute('disass profile s:Profiled')
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2282 assert_match('<SNR>\d*_Profiled\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2283 '# comment\_s*' ..
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2284 'echo "profiled"\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2285 '\d PROFILE START line 2\_s*' ..
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2286 '\d PUSHS "profiled"\_s*' ..
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2287 '\d ECHO 1\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2288 '# comment\_s*' ..
24920
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2289 'var some = "some text"\_s*' ..
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2290 '\d PROFILE END\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2291 '\d PROFILE START line 4\_s*' ..
24920
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2292 '\d PUSHS "some text"\_s*' ..
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2293 '\d STORE $0\_s*' ..
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2294 'return "done"\_s*' ..
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2295 '\d PROFILE END\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2296 '\d PROFILE START line 5\_s*' ..
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2297 '\d PUSHS "done"\_s*' ..
24920
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2298 '\d\+ RETURN\_s*' ..
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2299 '\d\+ PROFILE END',
23717
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2300 res)
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2301 enddef
e3720756acdc patch 8.2.2400: Vim9: compiled functions are not profiled
Bram Moolenaar <Bram@vim.org>
parents: 23691
diff changeset
2302
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2303 def Test_debugged()
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2304 var res = execute('disass debug s:Profiled')
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2305 assert_match('<SNR>\d*_Profiled\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2306 '# comment\_s*' ..
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2307 'echo "profiled"\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2308 '\d DEBUG line 1-2 varcount 0\_s*' ..
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2309 '\d PUSHS "profiled"\_s*' ..
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2310 '\d ECHO 1\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2311 '# comment\_s*' ..
24920
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2312 'var some = "some text"\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2313 '\d DEBUG line 3-4 varcount 0\_s*' ..
24920
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2314 '\d PUSHS "some text"\_s*' ..
6235e5d3523d patch 8.2.2997: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
2315 '\d STORE $0\_s*' ..
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2316 'return "done"\_s*' ..
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24984
diff changeset
2317 '\d DEBUG line 5-5 varcount 1\_s*' ..
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2318 '\d PUSHS "done"\_s*' ..
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2319 '\d RETURN\_s*',
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2320 res)
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2321 enddef
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 24826
diff changeset
2322
26352
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2323 def s:ElseifConstant()
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2324 if g:value
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2325 echo "one"
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2326 elseif true
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2327 echo "true"
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2328 elseif false
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2329 echo "false"
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2330 endif
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2331 enddef
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2332
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2333 def Test_debug_elseif_constant()
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2334 var res = execute('disass s:ElseifConstant')
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2335 assert_match('<SNR>\d*_ElseifConstant\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2336 'if g:value\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2337 '0 LOADG g:value\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2338 '1 COND2BOOL\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2339 '2 JUMP_IF_FALSE -> 6\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2340 'echo "one"\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2341 '3 PUSHS "one"\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2342 '4 ECHO 1\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2343 'elseif true\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2344 '5 JUMP -> 8\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2345 'echo "true"\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2346 '6 PUSHS "true"\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2347 '7 ECHO 1\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2348 'elseif false\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2349 'echo "false"\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2350 'endif\_s*' ..
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2351 '\d RETURN void*',
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2352 res)
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2353 enddef
f209f28ad898 patch 8.2.3707: Vim9: constant expression of elseif not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25814
diff changeset
2354
25660
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2355 def s:DebugElseif()
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2356 var b = false
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2357 if b
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2358 eval 1 + 0
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2359 silent elseif !b
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2360 eval 2 + 0
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2361 endif
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2362 enddef
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2363
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2364 def Test_debug_elseif()
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2365 var res = execute('disass debug s:DebugElseif')
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2366 assert_match('<SNR>\d*_DebugElseif\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2367 'var b = false\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2368 '0 DEBUG line 1-1 varcount 0\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2369 '1 PUSH false\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2370 '2 STORE $0\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2371
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2372 'if b\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2373 '3 DEBUG line 2-2 varcount 1\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2374 '4 LOAD $0\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2375 '5 JUMP_IF_FALSE -> 10\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2376
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2377 'eval 1 + 0\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2378 '6 DEBUG line 3-3 varcount 1\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2379 '7 PUSHNR 1\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2380 '8 DROP\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2381
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2382 'silent elseif !b\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2383 '9 JUMP -> 20\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2384 '10 CMDMOD silent\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2385 '11 DEBUG line 4-4 varcount 1\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2386 '12 LOAD $0\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2387 '13 INVERT -1 (!val)\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2388 '14 CMDMOD_REV\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2389 '15 JUMP_IF_FALSE -> 20\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2390
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2391 'eval 2 + 0\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2392 '16 DEBUG line 5-5 varcount 1\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2393 '17 PUSHNR 2\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2394 '18 DROP\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2395
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2396 'endif\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2397 '19 DEBUG line 6-6 varcount 1\_s*' ..
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2398 '20 RETURN void*',
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2399 res)
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2400 enddef
7b80b25a5c2b patch 8.2.3366: Vim9: debugging elseif does not stop before condition
Bram Moolenaar <Bram@vim.org>
parents: 25634
diff changeset
2401
25800
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2402 func Legacy() dict
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2403 echo 'legacy'
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2404 endfunc
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2405
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2406 def s:UseMember()
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2407 var d = {func: Legacy}
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2408 var v = d.func()
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2409 enddef
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2410
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2411 def Test_disassemble_dict_stack()
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2412 var res = execute('disass s:UseMember')
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2413 assert_match('<SNR>\d*_UseMember\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2414 'var d = {func: Legacy}\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2415 '\d PUSHS "func"\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2416 '\d PUSHFUNC "Legacy"\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2417 '\d NEWDICT size 1\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2418 '\d STORE $0\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2419
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2420 'var v = d.func()\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2421 '\d LOAD $0\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2422 '\d MEMBER func\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2423 '\d PCALL top (argc 0)\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2424 '\d PCALL end\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2425 '\d CLEARDICT\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2426 '\d\+ STORE $1\_s*' ..
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2427 '\d\+ RETURN void*',
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2428 res)
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2429 enddef
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2430
24444
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2431 def s:EchoMessages()
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2432 echohl ErrorMsg | echom v:exception | echohl NONE
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2433 enddef
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2434
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2435 def Test_disassemble_nextcmd()
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2436 # splitting commands and removing trailing blanks should not change the line
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2437 var res = execute('disass s:EchoMessages')
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2438 assert_match('<SNR>\d*_EchoMessages\_s*' ..
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2439 'echohl ErrorMsg | echom v:exception | echohl NONE',
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2440 res)
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2441 enddef
b5fbe8280853 patch 8.2.2762: Vim9: function line truncated when compiling
Bram Moolenaar <Bram@vim.org>
parents: 24430
diff changeset
2442
25461
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2443 def Test_disassemble_after_reload()
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2444 var lines =<< trim END
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2445 vim9script
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2446 if exists('g:ThisFunc')
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2447 finish
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2448 endif
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2449 var name: any
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2450 def g:ThisFunc(): number
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2451 g:name = name
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2452 return 0
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2453 enddef
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2454 def g:ThatFunc(): number
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2455 name = g:name
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2456 return 0
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2457 enddef
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2458 END
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2459 lines->writefile('Xreload.vim')
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2460
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2461 source Xreload.vim
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2462 g:ThisFunc()
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2463 g:ThatFunc()
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2464
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2465 source Xreload.vim
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2466 var res = execute('disass g:ThisFunc')
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2467 assert_match('ThisFunc\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2468 'g:name = name\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2469 '\d LOADSCRIPT \[deleted\] from .*/Xreload.vim\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2470 '\d STOREG g:name\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2471 'return 0\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2472 '\d PUSHNR 0\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2473 '\d RETURN\_s*',
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2474 res)
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2475
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2476 res = execute('disass g:ThatFunc')
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2477 assert_match('ThatFunc\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2478 'name = g:name\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2479 '\d LOADG g:name\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2480 '\d STORESCRIPT \[deleted\] in .*/Xreload.vim\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2481 'return 0\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2482 '\d PUSHNR 0\_s*' ..
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2483 '\d RETURN\_s*',
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2484 res)
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2485
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2486 delete('Xreload.vim')
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2487 delfunc g:ThisFunc
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2488 delfunc g:ThatFunc
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2489 enddef
891d08245543 patch 8.2.3267: Vim9: crash when disassembling using deleted script variable
Bram Moolenaar <Bram@vim.org>
parents: 25453
diff changeset
2490
23586
8c5374ec8a3d patch 8.2.2335: Vim9: "silent return" does not restore command modifiers
Bram Moolenaar <Bram@vim.org>
parents: 23557
diff changeset
2491
25800
fe8d153cb268 patch 8.2.3435: Vim9: dict is not passed to dict function
Bram Moolenaar <Bram@vim.org>
parents: 25660
diff changeset
2492
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2493 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker