Mercurial > vim
annotate src/testdir/test_vim9_disassemble.vim @ 20816:9faab49c880f v8.2.0960
patch 8.2.0960: cannot use :import in legacy Vim script
Commit: https://github.com/vim/vim/commit/9721fb4ea3db2559aaf7f71458da8ddda30ff93e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 11 23:10:46 2020 +0200
patch 8.2.0960: cannot use :import in legacy Vim script
Problem: Cannot use :import in legacy Vim script.
Solution: Support :import in any Vim script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 11 Jun 2020 23:15:03 +0200 |
parents | 489cb75c76b6 |
children | 0d7465881b06 |
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) |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 let local = 1 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 buffers |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 echo arg |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 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
|
20 echo &lines |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 echo v:version |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 echo s:scriptvar |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 echo g:globalvar |
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
|
24 echo 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
|
25 echo 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
|
26 echo t:tabpagevar |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 echo &tabstop |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 echo $ENVVAR |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 echo @z |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
32 def Test_disassemble_load() |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 assert_fails('disass NoFunc', 'E1061:') |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 assert_fails('disass NotCompiled', 'E1062:') |
19390
e4b326c9424a
patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents:
19342
diff
changeset
|
35 assert_fails('disass', 'E471:') |
e4b326c9424a
patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents:
19342
diff
changeset
|
36 assert_fails('disass [', 'E475:') |
e4b326c9424a
patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents:
19342
diff
changeset
|
37 assert_fails('disass 234', 'E475:') |
e4b326c9424a
patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents:
19342
diff
changeset
|
38 assert_fails('disass <XX>foo', 'E475:') |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 let 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
|
41 assert_match('<SNR>\d*_ScriptFuncLoad.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
42 'buffers.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
43 ' EXEC \+buffers.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
44 ' LOAD arg\[-1\].*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
45 ' LOAD $0.*' .. |
20301
e1a8d2040bd7
patch 8.2.0706: Vim9: using assert_fails() causes function to finish
Bram Moolenaar <Bram@vim.org>
parents:
20295
diff
changeset
|
46 ' LOADOPT &lines.*' .. |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
47 ' LOADV v:version.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
48 ' LOADS s:scriptvar from .*test_vim9_disassemble.vim.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
49 ' LOADG g:globalvar.*' .. |
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
|
50 ' LOADB 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
|
51 ' LOADW 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
|
52 ' LOADT t:tabpagevar.*' .. |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
53 ' LOADENV $ENVVAR.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
54 ' LOADREG @z.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
55 res) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 |
20170
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
58 def s:EditExpand() |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
59 let filename = "file" |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
60 let filenr = 123 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
61 edit the`=filename``=filenr`.txt |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
62 enddef |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
63 |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
64 def Test_disassemble_exec_expr() |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
65 let res = execute('disass s:EditExpand') |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
66 assert_match('<SNR>\d*_EditExpand.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
67 ' let filename = "file".*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
68 '\d PUSHS "file".*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
69 '\d STORE $0.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
70 ' let filenr = 123.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
71 '\d STORE 123 in $1.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
72 ' edit the`=filename``=filenr`.txt.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
73 '\d PUSHS "edit the".*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
74 '\d LOAD $0.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
75 '\d LOAD $1.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
76 '\d 2STRING stack\[-1\].*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
77 '\d PUSHS ".txt".*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
78 '\d EXECCONCAT 4.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
79 '\d PUSHNR 0.*' .. |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
80 '\d RETURN', |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
81 res) |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
82 enddef |
0612c64a2b87
patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
20142
diff
changeset
|
83 |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 def s:ScriptFuncPush() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 let localbool = true |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 let localspec = v:none |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 let localblob = 0z1234 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 if has('float') |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 let localfloat = 1.234 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 endif |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
93 def Test_disassemble_push() |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 let 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
|
95 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
|
96 'localbool = true.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
97 ' PUSH v:true.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
98 'localspec = v:none.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
99 ' PUSH v:none.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
100 'localblob = 0z1234.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
101 ' PUSHBLOB 0z1234.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
102 res) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 if has('float') |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
104 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
|
105 'localfloat = 1.234.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
106 ' PUSHF 1.234.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
107 res) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 endif |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 def s:ScriptFuncStore() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 let localnr = 1 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 localnr = 2 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 let localstr = 'abc' |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 localstr = 'xyz' |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 v:char = 'abc' |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 s:scriptvar = 'sv' |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 g:globalvar = 'gv' |
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
|
119 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
|
120 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
|
121 t:tabpagevar = 'tv' |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 &tabstop = 8 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 $ENVVAR = 'ev' |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 @z = 'rv' |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
127 def Test_disassemble_store() |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 let 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
|
129 assert_match('<SNR>\d*_ScriptFuncStore.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
130 'let localnr = 1.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
131 'localnr = 2.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
132 ' STORE 2 in $0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
133 'let localstr = ''abc''.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
134 'localstr = ''xyz''.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
135 ' STORE $1.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
136 'v:char = ''abc''.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
137 'STOREV v:char.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
138 's:scriptvar = ''sv''.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
139 ' 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
|
140 'g:globalvar = ''gv''.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
141 ' STOREG g:globalvar.*' .. |
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
|
142 '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
|
143 ' 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
|
144 '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
|
145 ' 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
|
146 '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
|
147 ' STORET t:tabpagevar.*' .. |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
148 '&tabstop = 8.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
149 ' STOREOPT &tabstop.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
150 '$ENVVAR = ''ev''.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
151 ' STOREENV $ENVVAR.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
152 '@z = ''rv''.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
153 ' STOREREG @z.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
154 res) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 |
20407
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
157 def s:ScriptFuncStoreMember() |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
158 let locallist: list<number> = [] |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
159 locallist[0] = 123 |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
160 let localdict: dict<number> = {} |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
161 localdict["a"] = 456 |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
162 enddef |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
163 |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
164 def Test_disassemble_store_member() |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
165 let res = execute('disass s:ScriptFuncStoreMember') |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
166 assert_match('<SNR>\d*_ScriptFuncStoreMember\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
167 'let locallist: list<number> = []\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
168 '\d NEWLIST size 0\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
169 '\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
|
170 '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
|
171 '\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
|
172 '\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
|
173 '\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
|
174 '\d STORELIST\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
175 'let localdict: dict<number> = {}\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
176 '\d NEWDICT size 0\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
177 '\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
|
178 '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
|
179 '\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
|
180 '\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
|
181 '\d\+ LOAD $1\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
182 '\d\+ STOREDICT\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
183 '\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
|
184 '\d\+ RETURN', |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
185 res) |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
186 enddef |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
187 |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
188 def s:ScriptFuncUnlet() |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
189 g:somevar = "value" |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
190 unlet g:somevar |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
191 unlet! g:somevar |
20099
058b41f85bcb
patch 8.2.0605: Vim9: cannot unlet an environment variable
Bram Moolenaar <Bram@vim.org>
parents:
20091
diff
changeset
|
192 unlet $SOMEVAR |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
193 enddef |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
194 |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
195 def Test_disassemble_unlet() |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
196 let 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
|
197 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
|
198 '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
|
199 '\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
|
200 '\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
|
201 '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
|
202 '\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
|
203 '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
|
204 '\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
|
205 'unlet $SOMEVAR\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
206 '\d UNLETENV $SOMEVAR\_s*', |
20091
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
207 res) |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
208 enddef |
a64c16ff98b8
patch 8.2.0601: Vim9: :unlet is not compiled
Bram Moolenaar <Bram@vim.org>
parents:
20089
diff
changeset
|
209 |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 def s:ScriptFuncTry() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 try |
20407
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
212 echo "yes" |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 catch /fail/ |
20407
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
214 echo "no" |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 finally |
20407
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
216 throw "end" |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 endtry |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
220 def Test_disassemble_try() |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 let 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
|
222 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
|
223 'try\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
224 '\d TRY catch -> \d\+, finally -> \d\+\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
225 'echo "yes"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
226 '\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
|
227 '\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
|
228 'catch /fail/\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
229 '\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
|
230 '\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
|
231 '\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
|
232 '\d COMPARESTRING =\~\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
233 '\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
|
234 '\d CATCH\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
235 'echo "no"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
236 '\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
|
237 '\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
|
238 'finally\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
239 'throw "end"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
240 '\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
|
241 '\d\+ THROW\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
242 'endtry\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
243 '\d\+ ENDTRY', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
244 res) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 def s:ScriptFuncNew() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 let ll = [1, "two", 333] |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 let dd = #{one: 1, two: "val"} |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
252 def Test_disassemble_new() |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 let 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
|
254 assert_match('<SNR>\d*_ScriptFuncNew\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
255 'let ll = \[1, "two", 333\]\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
256 '\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
|
257 '\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
|
258 '\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
|
259 '\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
|
260 '\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
|
261 'let dd = #{one: 1, two: "val"}\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
262 '\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
|
263 '\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
|
264 '\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
|
265 '\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
|
266 '\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
|
267 res) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 |
20029
8fb1cf4c44d5
patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
270 def FuncWithArg(arg: any) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 echo arg |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 func UserFunc() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 echo 'nothing' |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 endfunc |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 func UserFuncWithArg(arg) |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 echo a:arg |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 endfunc |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 def s:ScriptFuncCall(): string |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 changenr() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 char2nr("abc") |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
285 Test_disassemble_new() |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 FuncWithArg(343) |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 ScriptFuncNew() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 s:ScriptFuncNew() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 UserFunc() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 UserFuncWithArg("foo") |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 let FuncRef = function("UserFunc") |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 FuncRef() |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 let FuncRefWithArg = function("UserFuncWithArg") |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 FuncRefWithArg("bar") |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 return "yes" |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
298 def Test_disassemble_call() |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 let 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
|
300 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
|
301 'changenr()\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
302 '\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
|
303 '\d DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
304 'char2nr("abc")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
305 '\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
|
306 '\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
|
307 '\d DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
308 '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
|
309 '\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
|
310 '\d DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
311 'FuncWithArg(343)\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
312 '\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
|
313 '\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
|
314 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
315 'ScriptFuncNew()\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
316 '\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
|
317 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
318 's:ScriptFuncNew()\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
319 '\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
|
320 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
321 'UserFunc()\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
322 '\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
|
323 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
324 'UserFuncWithArg("foo")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
325 '\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
|
326 '\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
|
327 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
328 'let FuncRef = function("UserFunc")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
329 '\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
|
330 '\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
|
331 '\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
|
332 'FuncRef()\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
333 '\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
|
334 '\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
|
335 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
336 'let FuncRefWithArg = function("UserFuncWithArg")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
337 '\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
|
338 '\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
|
339 '\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
|
340 'FuncRefWithArg("bar")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
341 '\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
|
342 '\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
|
343 '\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
|
344 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
345 'return "yes"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
346 '\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
|
347 '\d\+ RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
348 res) |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 enddef |
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 |
20295
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
351 def s:CreateRefs() |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
352 let local = 'a' |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
353 def Append(arg: string) |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
354 local ..= arg |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
355 enddef |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
356 g:Append = Append |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
357 def Get(): string |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
358 return local |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
359 enddef |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
360 g:Get = Get |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
361 enddef |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
362 |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
363 def Test_disassemble_closure() |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
364 CreateRefs() |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
365 let res = execute('disass g:Append') |
20407
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
366 assert_match('<lambda>\d\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
367 'local ..= arg\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
368 '\d LOADOUTER $0\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
369 '\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
|
370 '\d CONCAT\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
371 '\d STOREOUTER $0\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
372 '\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
|
373 '\d RETURN', |
20295
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
374 res) |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
375 |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
376 res = execute('disass g:Get') |
20407
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
377 assert_match('<lambda>\d\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
378 'return local\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
379 '\d LOADOUTER $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 RETURN', |
20295
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
381 res) |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
382 |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
383 unlet g:Append |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
384 unlet g:Get |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
385 enddef |
bc2c9ea94ec1
patch 8.2.0703: Vim9: closure cannot store value in outer context
Bram Moolenaar <Bram@vim.org>
parents:
20170
diff
changeset
|
386 |
19483
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
387 |
19862
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
388 def EchoArg(arg: string): string |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
389 return arg |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
390 enddef |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
391 def RefThis(): func |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
392 return function('EchoArg') |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
393 enddef |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
394 def s:ScriptPCall() |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
395 RefThis()("text") |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
396 enddef |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
397 |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
398 def Test_disassemble_pcall() |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
399 let 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
|
400 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
|
401 'RefThis()("text")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
402 '\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
|
403 '\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
|
404 '\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
|
405 '\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
|
406 '\d DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
407 '\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
|
408 '\d RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
409 res) |
19862
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
410 enddef |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
411 |
846fbbacce3a
patch 8.2.0487: Vim9: compiling not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19703
diff
changeset
|
412 |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20029
diff
changeset
|
413 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
|
414 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
|
415 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
|
416 |
b8f778dda1a1
patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents:
19528
diff
changeset
|
417 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
|
418 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
|
419 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
|
420 |
b8f778dda1a1
patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents:
19528
diff
changeset
|
421 def Test_disassemble_update_instr() |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20029
diff
changeset
|
422 let 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
|
423 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
|
424 '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
|
425 '\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
|
426 '\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
|
427 '\d RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
428 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
|
429 |
b8f778dda1a1
patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents:
19528
diff
changeset
|
430 " Calling the function will change UCALL into the faster DCALL |
b8f778dda1a1
patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents:
19528
diff
changeset
|
431 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
|
432 |
20079
336483164ca6
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Bram Moolenaar <Bram@vim.org>
parents:
20029
diff
changeset
|
433 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
|
434 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
|
435 '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
|
436 '\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
|
437 '\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
|
438 '\d RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
439 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
|
440 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
|
441 |
b8f778dda1a1
patch 8.2.0323: Vim9: calling a function that is defined later is slow
Bram Moolenaar <Bram@vim.org>
parents:
19528
diff
changeset
|
442 |
19483
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
443 def FuncWithDefault(arg: string = 'default'): string |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
444 return arg |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
445 enddef |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
446 |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
447 def Test_disassemble_call_default() |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
448 let 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
|
449 assert_match('FuncWithDefault\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
450 '\d PUSHS "default"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
451 '\d STORE arg\[-1]\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
452 'return arg\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
453 '\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
|
454 '\d RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
455 res) |
19483
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
456 enddef |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
457 |
0d3dcb4476ba
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Bram Moolenaar <Bram@vim.org>
parents:
19439
diff
changeset
|
458 |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
459 def HasEval() |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
460 if has("eval") |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
461 echo "yes" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
462 else |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
463 echo "no" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
464 endif |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
465 enddef |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
466 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
467 def HasNothing() |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
468 if has("nothing") |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
469 echo "yes" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
470 else |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
471 echo "no" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
472 endif |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
473 enddef |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
474 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
475 def HasSomething() |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
476 if has("nothing") |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
477 echo "nothing" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
478 elseif has("something") |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
479 echo "something" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
480 elseif has("eval") |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
481 echo "eval" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
482 elseif has("less") |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
483 echo "less" |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
484 endif |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
485 enddef |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
486 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
487 def Test_disassemble_const_expr() |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
488 assert_equal("\nyes", execute('call HasEval()')) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
489 let 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
|
490 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
|
491 '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
|
492 'echo "yes"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
493 '\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
|
494 '\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
|
495 'else\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
496 'echo "no"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
497 'endif\_s*', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
498 instr) |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
499 assert_notmatch('JUMP', instr) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
500 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
501 assert_equal("\nno", execute('call HasNothing()')) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
502 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
|
503 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
|
504 '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
|
505 'echo "yes"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
506 'else\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
507 'echo "no"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
508 '\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
|
509 '\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
|
510 'endif', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
511 instr) |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
512 assert_notmatch('PUSHS "yes"', instr) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
513 assert_notmatch('JUMP', instr) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
514 |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
515 assert_equal("\neval", execute('call HasSomething()')) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
516 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
|
517 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
|
518 '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
|
519 'echo "nothing"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
520 '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
|
521 'echo "something"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
522 '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
|
523 'echo "eval"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
524 '\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
|
525 '\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
|
526 'elseif has("less").*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
527 'echo "less"\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
528 'endif', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
529 instr) |
19332
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
530 assert_notmatch('PUSHS "nothing"', instr) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
531 assert_notmatch('PUSHS "something"', instr) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
532 assert_notmatch('PUSHS "less"', instr) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
533 assert_notmatch('JUMP', instr) |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
534 enddef |
d6e8a9e80be4
patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19330
diff
changeset
|
535 |
19572
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
536 def WithFunc() |
19912
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
537 let Funky1: func |
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
538 let Funky2: func = function("len") |
d4fa9db88d16
patch 8.2.0512: Vim9: no optional arguments in func type
Bram Moolenaar <Bram@vim.org>
parents:
19904
diff
changeset
|
539 let 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
|
540 enddef |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
541 |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
542 def Test_disassemble_function() |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
543 let 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
|
544 assert_match('WithFunc\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
545 'let Funky1: func\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
546 '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
|
547 '1 STORE $0\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
548 'let Funky2: func = function("len")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
549 '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
|
550 '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
|
551 '4 STORE $1\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
552 'let Party2: func = funcref("UserFunc")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
553 '\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
|
554 '\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
|
555 '\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
|
556 '\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
|
557 '\d RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
558 instr) |
19572
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
559 enddef |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
560 |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
561 if has('channel') |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
562 def WithChannel() |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
563 let job1: job |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
564 let job2: job = job_start("donothing") |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
565 let chan1: channel |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
566 enddef |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
567 endif |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
568 |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
569 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
|
570 CheckFeature channel |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
571 |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
572 let 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
|
573 assert_match('WithChannel\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
574 'let job1: job\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
575 '\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
|
576 '\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
|
577 'let job2: job = job_start("donothing")\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
578 '\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
|
579 '\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
|
580 '\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
|
581 'let chan1: channel\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
582 '\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
|
583 '\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
|
584 '\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
|
585 '\d RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
586 instr) |
19572
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
587 enddef |
6b6e97d0185e
patch 8.2.0343: Vim9: using wrong instruction, limited test coverage
Bram Moolenaar <Bram@vim.org>
parents:
19532
diff
changeset
|
588 |
19334
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
589 def WithLambda(): string |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
590 let F = {a -> "X" .. a .. "X"} |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
591 return F("x") |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
592 enddef |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
593 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
594 def Test_disassemble_lambda() |
19334
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
595 assert_equal("XxX", WithLambda()) |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
596 let 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
|
597 assert_match('WithLambda\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
598 'let F = {a -> "X" .. a .. "X"}\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
599 '\d FUNCREF <lambda>\d\+ $1\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
600 '\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
|
601 '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
|
602 '\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
|
603 '\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
|
604 '\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
|
605 '\d RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
606 instr) |
19334
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
607 enddef |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
608 |
20029
8fb1cf4c44d5
patch 8.2.0570: Vim9: no error when omitting type from argument
Bram Moolenaar <Bram@vim.org>
parents:
20019
diff
changeset
|
609 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
|
610 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
|
611 return 'yes' |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
612 endif |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
613 return 'no' |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
614 enddef |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
615 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
616 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
|
617 assert_equal("yes", AndOr(1)) |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
618 assert_equal("no", AndOr(2)) |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
619 assert_equal("yes", AndOr(4)) |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
620 let 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
|
621 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
|
622 '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
|
623 '\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
|
624 '\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
|
625 '\d COMPAREANY ==\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
626 '\d JUMP_AND_KEEP_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
|
627 '\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
|
628 '\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
|
629 '\d COMPAREANY !=\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
630 '\d JUMP_AND_KEEP_IF_TRUE -> \d\+\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
631 '\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
|
632 '\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
|
633 '\d\+ COMPAREANY ==\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
634 '\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
|
635 instr) |
19334
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
636 enddef |
61646c189622
patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
19332
diff
changeset
|
637 |
19336
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
638 def ForLoop(): list<number> |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
639 let res: list<number> |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
640 for i in range(3) |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
641 res->add(i) |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
642 endfor |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
643 return res |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
644 enddef |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
645 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
646 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
|
647 assert_equal([0, 1, 2], ForLoop()) |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
648 let 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
|
649 assert_match('ForLoop\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
650 'let res: list<number>\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
651 '\d NEWLIST size 0\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
652 '\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
|
653 '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
|
654 '\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
|
655 '\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
|
656 '\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
|
657 '\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
|
658 '\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
|
659 '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
|
660 '\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
|
661 '\d LOAD $2\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
662 '\d\+ BCALL add(argc 2)\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
663 '\d\+ DROP\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
664 'endfor\_s*' .. |
33166d945b54
patch 8.2.0758: Vim9: no test for STORELIST and STOREDICT
Bram Moolenaar <Bram@vim.org>
parents:
20405
diff
changeset
|
665 '\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
|
666 '\d\+ DROP', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
667 instr) |
19336
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
668 enddef |
1cd6eab65ce0
patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents:
19334
diff
changeset
|
669 |
19338
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
670 let g:number = 42 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
671 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
672 def Computing() |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
673 let nr = 3 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
674 let nrres = nr + 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
675 nrres = nr - 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
676 nrres = nr * 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
677 nrres = nr / 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
678 nrres = nr % 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
679 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
680 let anyres = g:number + 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
681 anyres = g:number - 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
682 anyres = g:number * 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
683 anyres = g:number / 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
684 anyres = g:number % 7 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
685 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
686 if has('float') |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
687 let fl = 3.0 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
688 let flres = fl + 7.0 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
689 flres = fl - 7.0 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
690 flres = fl * 7.0 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
691 flres = fl / 7.0 |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
692 endif |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
693 enddef |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
694 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
695 def Test_disassemble_computing() |
19338
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
696 let 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
|
697 assert_match('Computing.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
698 'let nr = 3.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
699 '\d STORE 3 in $0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
700 'let nrres = nr + 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
701 '\d LOAD $0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
702 '\d PUSHNR 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
703 '\d OPNR +.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
704 '\d STORE $1.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
705 'nrres = nr - 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
706 '\d OPNR -.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
707 'nrres = nr \* 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
708 '\d OPNR \*.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
709 'nrres = nr / 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
710 '\d OPNR /.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
711 'nrres = nr % 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
712 '\d OPNR %.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
713 'let anyres = g:number + 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
714 '\d LOADG g:number.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
715 '\d PUSHNR 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
716 '\d OPANY +.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
717 '\d STORE $2.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
718 'anyres = g:number - 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
719 '\d OPANY -.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
720 'anyres = g:number \* 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
721 '\d OPANY \*.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
722 'anyres = g:number / 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
723 '\d OPANY /.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
724 'anyres = g:number % 7.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
725 '\d OPANY %.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
726 instr) |
19338
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
727 if has('float') |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
728 assert_match('Computing.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
729 'let fl = 3.0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
730 '\d PUSHF 3.0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
731 '\d STORE $3.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
732 'let flres = fl + 7.0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
733 '\d LOAD $3.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
734 '\d PUSHF 7.0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
735 '\d OPFLOAT +.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
736 '\d STORE $4.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
737 'flres = fl - 7.0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
738 '\d OPFLOAT -.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
739 'flres = fl \* 7.0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
740 '\d OPFLOAT \*.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
741 'flres = fl / 7.0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
742 '\d OPFLOAT /.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
743 instr) |
19338
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
744 endif |
ef432264b88a
patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19336
diff
changeset
|
745 enddef |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
746 |
19439
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
747 def AddListBlob() |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
748 let reslist = [1, 2] + [3, 4] |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
749 let resblob = 0z1122 + 0z3344 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
750 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
751 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
752 def Test_disassemble_add_list_blob() |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
753 let 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
|
754 assert_match('AddListBlob.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
755 'let reslist = \[1, 2] + \[3, 4].*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
756 '\d PUSHNR 1.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
757 '\d PUSHNR 2.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
758 '\d NEWLIST size 2.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
759 '\d PUSHNR 3.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
760 '\d PUSHNR 4.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
761 '\d NEWLIST size 2.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
762 '\d ADDLIST.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
763 '\d STORE $.*.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
764 'let resblob = 0z1122 + 0z3344.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
765 '\d PUSHBLOB 0z1122.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
766 '\d PUSHBLOB 0z3344.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
767 '\d ADDBLOB.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
768 '\d STORE $.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
769 instr) |
19439
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
770 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
771 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
772 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
|
773 def ConcatString(): string |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
774 let res = g:aa .. "bb" |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
775 return res |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
776 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
777 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
778 def Test_disassemble_concat() |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
779 let 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
|
780 assert_match('ConcatString.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
781 'let res = g:aa .. "bb".*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
782 '\d LOADG g:aa.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
783 '\d PUSHS "bb".*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
784 '\d 2STRING stack\[-2].*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
785 '\d CONCAT.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
786 '\d STORE $.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
787 instr) |
19439
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
788 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
|
789 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
790 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
791 def ListIndex(): number |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
792 let l = [1, 2, 3] |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
793 let res = l[1] |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
794 return res |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
795 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
796 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
797 def Test_disassemble_list_index() |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
798 let 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
|
799 assert_match('ListIndex\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
800 'let l = \[1, 2, 3]\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
801 '\d PUSHNR 1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
802 '\d PUSHNR 2\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
803 '\d PUSHNR 3\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
804 '\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
|
805 '\d STORE $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
806 'let res = l\[1]\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
807 '\d LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
808 '\d PUSHNR 1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
809 '\d INDEX\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
810 '\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
|
811 instr) |
19439
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
812 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
|
813 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
814 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
815 def DictMember(): number |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
816 let d = #{item: 1} |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
817 let res = d.item |
20405
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
818 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
|
819 return res |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
820 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
821 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
822 def Test_disassemble_dict_member() |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
823 let 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
|
824 assert_match('DictMember\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
825 'let d = #{item: 1}\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
826 '\d PUSHS "item"\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
827 '\d PUSHNR 1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
828 '\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
|
829 '\d STORE $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
830 'let res = d.item\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
831 '\d\+ LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
832 '\d\+ MEMBER item\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
833 '\d\+ STORE $1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
834 'res = d\["item"\]\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
835 '\d\+ LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
836 '\d\+ PUSHS "item"\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
837 '\d\+ MEMBER\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
838 '\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
|
839 instr) |
19439
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
840 call assert_equal(1, DictMember()) |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
841 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
842 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
843 def NegateNumber(): number |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
844 let nr = 9 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
845 let plus = +nr |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
846 let res = -nr |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
847 return res |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
848 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
849 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
850 def Test_disassemble_negate_number() |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
851 let 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
|
852 assert_match('NegateNumber\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
853 'let nr = 9\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
854 '\d STORE 9 in $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
855 'let plus = +nr\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
856 '\d LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
857 '\d CHECKNR\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
858 '\d STORE $1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
859 'let res = -nr\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
860 '\d LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
861 '\d NEGATENR\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
862 '\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
|
863 instr) |
19439
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
864 call assert_equal(-9, NegateNumber()) |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
865 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
866 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
867 def InvertBool(): bool |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
868 let flag = true |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
869 let invert = !flag |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
870 let res = !!flag |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
871 return res |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
872 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
873 |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
874 def Test_disassemble_invert_bool() |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
875 let 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
|
876 assert_match('InvertBool\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
877 'let flag = true\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
878 '\d PUSH v:true\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
879 '\d STORE $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
880 'let invert = !flag\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
881 '\d LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
882 '\d INVERT (!val)\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
883 '\d STORE $1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
884 'let res = !!flag\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
885 '\d LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
886 '\d 2BOOL (!!val)\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
887 '\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
|
888 instr) |
19439
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
889 call assert_equal(true, InvertBool()) |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
890 enddef |
b347a6c61090
patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19390
diff
changeset
|
891 |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
892 def Test_disassemble_compare() |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
893 let 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
|
894 ['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
|
895 ['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
|
896 ['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
|
897 ['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
|
898 |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
899 ['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
|
900 ['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
|
901 ['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
|
902 ['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
|
903 ['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
|
904 ['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
|
905 ['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
|
906 ['111 !~ aNumber', 'COMPARENR !\~'], |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
907 |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
908 ['"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
|
909 ['"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
|
910 ['"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
|
911 ['"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
|
912 ['"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
|
913 ['"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
|
914 ['"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
|
915 ['"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
|
916 ['"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
|
917 |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
918 ['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
|
919 ['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
|
920 ['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
|
921 ['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
|
922 |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
923 ['[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
|
924 ['[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
|
925 ['[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
|
926 ['[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
|
927 |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
928 ['#{a: 1} == aDict', 'COMPAREDICT =='], |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
929 ['#{a: 1} != aDict', 'COMPAREDICT !='], |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
930 ['#{a: 1} is aDict', 'COMPAREDICT is'], |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
931 ['#{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
|
932 |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
933 ['{->33} == {->44}', 'COMPAREFUNC =='], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
934 ['{->33} != {->44}', 'COMPAREFUNC !='], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
935 ['{->33} is {->44}', 'COMPAREFUNC is'], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
936 ['{->33} isnot {->44}', 'COMPAREFUNC isnot'], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
937 |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
938 ['77 == g:xx', 'COMPAREANY =='], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
939 ['77 != g:xx', 'COMPAREANY !='], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
940 ['77 > g:xx', 'COMPAREANY >'], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
941 ['77 < g:xx', 'COMPAREANY <'], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
942 ['77 >= g:xx', 'COMPAREANY >='], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
943 ['77 <= g:xx', 'COMPAREANY <='], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
944 ['77 =~ g:xx', 'COMPAREANY =\~'], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
945 ['77 !~ g:xx', 'COMPAREANY !\~'], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
946 ['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
|
947 ['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
|
948 ] |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
949 let floatDecl = '' |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
950 if has('float') |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
951 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
|
952 ['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
|
953 ['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
|
954 ['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
|
955 ['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
|
956 ['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
|
957 ['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
|
958 ['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
|
959 ['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
|
960 ]) |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
961 floatDecl = 'let aFloat = 2.2' |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
962 endif |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
963 |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
964 let nr = 1 |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
965 for case in 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
|
966 " 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
|
967 writefile(['def TestCase' .. nr .. '()', |
20328
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
968 ' let isFalse = false', |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
969 ' let isNull = v:null', |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
970 ' let aNumber = 222', |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
971 ' let aString = "yy"', |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
972 ' let aBlob = 0z22', |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
973 ' let aList = [3, 4]', |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
974 ' let aDict = #{x: 2}', |
445c2b2ea44b
patch 8.2.0719: Vim9: more expressions can be evaluated at compile time
Bram Moolenaar <Bram@vim.org>
parents:
20324
diff
changeset
|
975 floatDecl, |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
976 ' if ' .. case[0], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
977 ' echo 42' |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
978 ' endif', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
979 'enddef'], 'Xdisassemble') |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
980 source Xdisassemble |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
981 let 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
|
982 assert_match('TestCase' .. nr .. '.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
983 '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
|
984 '\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
|
985 '\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
|
986 '\d ' .. case[1] .. '.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
987 '\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
|
988 instr) |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
989 |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
990 nr += 1 |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
991 endfor |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
992 |
19703
f03357f16ffc
patch 8.2.0408: delete() commented out for testing
Bram Moolenaar <Bram@vim.org>
parents:
19579
diff
changeset
|
993 delete('Xdisassemble') |
19342
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
994 enddef |
8ff84bc1c89b
patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents:
19338
diff
changeset
|
995 |
19880
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
996 def Test_disassemble_compare_const() |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
997 let cases = [ |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
998 ['"xx" == "yy"', false], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
999 ['"aa" == "aa"', true], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1000 ['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
|
1001 ['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
|
1002 ] |
19880
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1003 |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1004 let nr = 1 |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1005 for case in cases |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1006 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
|
1007 ' if ' .. case[0], |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1008 ' echo 42' |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1009 ' endif', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1010 'enddef'], 'Xdisassemble') |
19880
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1011 source Xdisassemble |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1012 let instr = execute('disassemble TestCase' .. nr) |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1013 if case[1] |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1014 " 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
|
1015 assert_match('TestCase' .. nr .. '.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1016 '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
|
1017 '\d PUSHNR 42.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1018 '\d ECHO 1.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1019 '\d PUSHNR 0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1020 '\d RETURN.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1021 instr) |
19880
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1022 else |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1023 " 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
|
1024 assert_match('TestCase' .. nr .. '.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1025 '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
|
1026 'echo 42[ \n]*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1027 'endif[ \n]*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1028 '\s*\d PUSHNR 0.*' .. |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1029 '\d RETURN.*', |
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1030 instr) |
19880
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1031 endif |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1032 |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1033 nr += 1 |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1034 endfor |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1035 |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1036 delete('Xdisassemble') |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1037 enddef |
50fa63ca3828
patch 8.2.0496: Vim9: disassemble test fails
Bram Moolenaar <Bram@vim.org>
parents:
19862
diff
changeset
|
1038 |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1039 def s:Execute() |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1040 execute 'help vim9.txt' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1041 let cmd = 'help vim9.txt' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1042 execute cmd |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1043 let tag = 'vim9.txt' |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1044 execute 'help ' .. tag |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1045 enddef |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1046 |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1047 def Test_disassemble_execute() |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1048 let 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
|
1049 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
|
1050 "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
|
1051 '\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
|
1052 '\d EXECUTE 1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1053 "let cmd = 'help vim9.txt'\\_s*" .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1054 '\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
|
1055 '\d STORE $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1056 'execute cmd\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1057 '\d LOAD $0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1058 '\d EXECUTE 1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1059 "let tag = 'vim9.txt'\\_s*" .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1060 '\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
|
1061 '\d STORE $1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1062 "execute 'help ' .. tag\\_s*" .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1063 '\d\+ PUSHS "help "\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1064 '\d\+ LOAD $1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1065 '\d\+ CONCAT\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1066 '\d\+ EXECUTE 1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1067 '\d\+ PUSHNR 0\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1068 '\d\+ RETURN', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1069 res) |
19528
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1070 enddef |
3b026343f398
patch 8.2.0321: Vim9: ":execute" does not work yet
Bram Moolenaar <Bram@vim.org>
parents:
19483
diff
changeset
|
1071 |
20142
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1072 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
|
1073 echomsg 'some' 'message' |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1074 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
|
1075 enddef |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1076 |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1077 def Test_disassemble_echomsg() |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1078 let 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
|
1079 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
|
1080 "echomsg 'some' 'message'\\_s*" .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1081 '\d PUSHS "some"\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1082 '\d PUSHS "message"\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1083 '\d ECHOMSG 2\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1084 "echoerr 'went' .. 'wrong'\\_s*" .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1085 '\d PUSHS "wentwrong"\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1086 '\d ECHOERR 1\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1087 '\d PUSHNR 0\_s*' .. |
20142
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1088 '\d RETURN', |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1089 res) |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1090 enddef |
fe8d0a4344df
patch 8.2.0626: Vim9: wrong syntax of function in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20099
diff
changeset
|
1091 |
19579
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1092 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
|
1093 echo arg |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1094 enddef |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1095 |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1096 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
|
1097 echo arg |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1098 enddef |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1099 |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1100 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
|
1101 return arg |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1102 enddef |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1103 |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1104 def Test_display_func() |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1105 let 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
|
1106 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
|
1107 '\d *echo arg.*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1108 ' *enddef', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1109 res1) |
19579
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1110 |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1111 let 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
|
1112 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
|
1113 '\d *echo arg\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1114 ' *enddef', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1115 res2) |
19579
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1116 |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1117 let 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
|
1118 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
|
1119 '\d *return arg\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1120 ' *enddef', |
20019
e9af5a09a55b
patch 8.2.0565: Vim9: tests contain superfluous line continuation
Bram Moolenaar <Bram@vim.org>
parents:
19912
diff
changeset
|
1121 res3) |
19579
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1122 enddef |
aae19dd172c0
patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents:
19572
diff
changeset
|
1123 |
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
|
1124 def Test_vim9script_forward_func() |
7587d892c00c
patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20336
diff
changeset
|
1125 let lines =<< trim 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
|
1126 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
|
1127 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
|
1128 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
|
1129 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
|
1130 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
|
1131 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
|
1132 enddef |
20397
c225be44692a
patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Bram Moolenaar <Bram@vim.org>
parents:
20339
diff
changeset
|
1133 let g:res_FuncOne: string = 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
|
1134 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
|
1135 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
|
1136 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
|
1137 |
7587d892c00c
patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20336
diff
changeset
|
1138 " 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
|
1139 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
|
1140 'return FuncTwo()\_s*' .. |
83573e907c8b
patch 8.2.0757: Vim9: no test for MEMBER instruction
Bram Moolenaar <Bram@vim.org>
parents:
20397
diff
changeset
|
1141 '\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
|
1142 '\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
|
1143 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
|
1144 |
7587d892c00c
patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Bram Moolenaar <Bram@vim.org>
parents:
20336
diff
changeset
|
1145 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
|
1146 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
|
1147 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
|
1148 |
20305
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1149 def s:ConcatStrings(): string |
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1150 return 'one' .. 'two' .. 'three' |
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1151 enddef |
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1152 |
20324
23188ef99fc2
patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents:
20305
diff
changeset
|
1153 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
|
1154 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
|
1155 enddef |
23188ef99fc2
patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents:
20305
diff
changeset
|
1156 |
20336
2fd980fb9ab3
patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents:
20328
diff
changeset
|
1157 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
|
1158 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
|
1159 enddef |
2fd980fb9ab3
patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents:
20328
diff
changeset
|
1160 |
20305
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1161 def Test_simplify_const_expr() |
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1162 let 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
|
1163 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
|
1164 "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
|
1165 '\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
|
1166 '\d RETURN', |
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1167 res) |
20324
23188ef99fc2
patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents:
20305
diff
changeset
|
1168 |
23188ef99fc2
patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents:
20305
diff
changeset
|
1169 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
|
1170 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
|
1171 '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
|
1172 '\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
|
1173 '\d RETURN', |
23188ef99fc2
patch 8.2.0717: Vim9: postponed constant expressions does not scale
Bram Moolenaar <Bram@vim.org>
parents:
20305
diff
changeset
|
1174 res) |
20336
2fd980fb9ab3
patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents:
20328
diff
changeset
|
1175 |
2fd980fb9ab3
patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents:
20328
diff
changeset
|
1176 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
|
1177 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
|
1178 '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
|
1179 '\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
|
1180 '\d RETURN', |
2fd980fb9ab3
patch 8.2.0723: Vim9: nested constant expression not evaluated compile time
Bram Moolenaar <Bram@vim.org>
parents:
20328
diff
changeset
|
1181 res) |
20305
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1182 enddef |
9a5e2370df0e
patch 8.2.0708: Vim9: constant expressions are not simplified
Bram Moolenaar <Bram@vim.org>
parents:
20301
diff
changeset
|
1183 |
19330
9c8b803fe598
patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1184 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |