annotate src/testdir/test_vim9_disassemble.vim @ 19439:b347a6c61090 v8.2.0277

patch 8.2.0277: Vim9: not all instructions covered by tests Commit: https://github.com/vim/vim/commit/ee2e52aa0655e02f900c74fb3a770bc55956d63d Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 19 14:17:18 2020 +0100 patch 8.2.0277: Vim9: not all instructions covered by tests Problem: Vim9: not all instructions covered by tests. Solution: Add more test cases.
author Bram Moolenaar <Bram@vim.org>
date Wed, 19 Feb 2020 14:30:03 +0100
parents e4b326c9424a
children 0d3dcb4476ba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test the :disassemble command, and compilation as a side effect
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 func NotCompiled()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 echo "not"
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 endfunc
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 let s:scriptvar = 4
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 let g:globalvar = 'g'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 def s:ScriptFuncLoad(arg: string)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 let local = 1
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 buffers
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 echo arg
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 echo local
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 echo v:version
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 echo s:scriptvar
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 echo g:globalvar
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 echo &tabstop
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 echo $ENVVAR
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 echo @z
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
23 def Test_disassemble_load()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 assert_fails('disass NoFunc', 'E1061:')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 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
26 assert_fails('disass', 'E471:')
e4b326c9424a patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents: 19342
diff changeset
27 assert_fails('disass [', 'E475:')
e4b326c9424a patch 8.2.0253: crash when using :disassamble without argument
Bram Moolenaar <Bram@vim.org>
parents: 19342
diff changeset
28 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
29 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
30
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 let res = execute('disass s:ScriptFuncLoad')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 assert_match('<SNR>\d*_ScriptFuncLoad.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 \ .. 'buffers.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 \ .. ' EXEC \+buffers.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 \ .. ' LOAD arg\[-1\].*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 \ .. ' LOAD $0.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ .. ' LOADV v:version.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ .. ' LOADS s:scriptvar from .*test_vim9_disassemble.vim.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ .. ' LOADG g:globalvar.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ .. ' LOADENV $ENVVAR.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ .. ' LOADREG @z.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \, res)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 def s:ScriptFuncPush()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 let localbool = true
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 let localspec = v:none
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 let localblob = 0z1234
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 if has('float')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 let localfloat = 1.234
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 endif
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
54 def Test_disassemble_push()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 let res = execute('disass s:ScriptFuncPush')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 assert_match('<SNR>\d*_ScriptFuncPush.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 \ .. 'localbool = true.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 \ .. ' PUSH v:true.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 \ .. 'localspec = v:none.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 \ .. ' PUSH v:none.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 \ .. 'localblob = 0z1234.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 \ .. ' PUSHBLOB 0z1234.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 \, res)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 if has('float')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 assert_match('<SNR>\d*_ScriptFuncPush.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 \ .. 'localfloat = 1.234.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 \ .. ' PUSHF 1.234.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 \, res)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 endif
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 def s:ScriptFuncStore()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 let localnr = 1
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 localnr = 2
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 let localstr = 'abc'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 localstr = 'xyz'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 v:char = 'abc'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 s:scriptvar = 'sv'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 g:globalvar = 'gv'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 &tabstop = 8
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 $ENVVAR = 'ev'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 @z = 'rv'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
85 def Test_disassemble_store()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 let res = execute('disass s:ScriptFuncStore')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 assert_match('<SNR>\d*_ScriptFuncStore.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 \ .. 'localnr = 2.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 \ .. ' STORE 2 in $0.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 \ .. 'localstr = ''xyz''.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 \ .. ' STORE $1.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 \ .. 'v:char = ''abc''.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 \ .. 'STOREV v:char.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 \ .. 's:scriptvar = ''sv''.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 \ .. ' STORES s:scriptvar in .*test_vim9_disassemble.vim.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 \ .. 'g:globalvar = ''gv''.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 \ .. ' STOREG g:globalvar.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 \ .. '&tabstop = 8.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 \ .. ' STOREOPT &tabstop.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 \ .. '$ENVVAR = ''ev''.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 \ .. ' STOREENV $ENVVAR.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 \ .. '@z = ''rv''.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 \ .. ' STOREREG @z.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 \, res)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 def s:ScriptFuncTry()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 try
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 echo 'yes'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 catch /fail/
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 echo 'no'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 finally
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
113 throw 'end'
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 endtry
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
117 def Test_disassemble_try()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 let res = execute('disass s:ScriptFuncTry')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 assert_match('<SNR>\d*_ScriptFuncTry.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 \ .. 'try.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 \ .. 'TRY catch -> \d\+, finally -> \d\+.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 \ .. 'catch /fail/.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 \ .. ' JUMP -> \d\+.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 \ .. ' PUSH v:exception.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 \ .. ' PUSHS "fail".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 \ .. ' COMPARESTRING =\~.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 \ .. ' JUMP_IF_FALSE -> \d\+.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 \ .. ' CATCH.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 \ .. 'finally.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 \ .. ' PUSHS "end".*'
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
131 \ .. ' THROW.*'
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 \ .. 'endtry.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 \ .. ' ENDTRY.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 \, res)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 def s:ScriptFuncNew()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 let ll = [1, "two", 333]
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 let dd = #{one: 1, two: "val"}
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
142 def Test_disassemble_new()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 let res = execute('disass s:ScriptFuncNew')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 assert_match('<SNR>\d*_ScriptFuncNew.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 \ .. 'let ll = \[1, "two", 333].*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 \ .. 'PUSHNR 1.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 \ .. 'PUSHS "two".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 \ .. 'PUSHNR 333.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 \ .. 'NEWLIST size 3.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 \ .. 'let dd = #{one: 1, two: "val"}.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 \ .. 'PUSHS "one".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 \ .. 'PUSHNR 1.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 \ .. 'PUSHS "two".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 \ .. 'PUSHS "val".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 \ .. 'NEWDICT size 2.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 \, res)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 def FuncWithArg(arg)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 echo arg
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 func UserFunc()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 echo 'nothing'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 endfunc
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 func UserFuncWithArg(arg)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 echo a:arg
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 endfunc
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 def s:ScriptFuncCall(): string
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 changenr()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 char2nr("abc")
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
174 Test_disassemble_new()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 FuncWithArg(343)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 ScriptFuncNew()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 s:ScriptFuncNew()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 UserFunc()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 UserFuncWithArg("foo")
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 let FuncRef = function("UserFunc")
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 FuncRef()
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 let FuncRefWithArg = function("UserFuncWithArg")
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 FuncRefWithArg("bar")
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 return "yes"
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
187 def Test_disassemble_call()
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 let res = execute('disass s:ScriptFuncCall')
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 assert_match('<SNR>\d\+_ScriptFuncCall.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 \ .. 'changenr().*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 \ .. ' BCALL changenr(argc 0).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 \ .. 'char2nr("abc").*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 \ .. ' PUSHS "abc".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 \ .. ' BCALL char2nr(argc 1).*'
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
195 \ .. 'Test_disassemble_new().*'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
196 \ .. ' DCALL Test_disassemble_new(argc 0).*'
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 \ .. 'FuncWithArg(343).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 \ .. ' PUSHNR 343.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 \ .. ' DCALL FuncWithArg(argc 1).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 \ .. 'ScriptFuncNew().*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 \ .. ' DCALL <SNR>\d\+_ScriptFuncNew(argc 0).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 \ .. 's:ScriptFuncNew().*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 \ .. ' DCALL <SNR>\d\+_ScriptFuncNew(argc 0).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 \ .. 'UserFunc().*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 \ .. ' UCALL UserFunc(argc 0).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 \ .. 'UserFuncWithArg("foo").*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 \ .. ' PUSHS "foo".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 \ .. ' UCALL UserFuncWithArg(argc 1).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 \ .. 'let FuncRef = function("UserFunc").*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 \ .. 'FuncRef().*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 \ .. ' LOAD $\d.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 \ .. ' PCALL (argc 0).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 \ .. 'let FuncRefWithArg = function("UserFuncWithArg").*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 \ .. 'FuncRefWithArg("bar").*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 \ .. ' PUSHS "bar".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 \ .. ' LOAD $\d.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 \ .. ' PCALL (argc 1).*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 \ .. 'return "yes".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 \ .. ' PUSHS "yes".*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 \ .. ' RETURN.*'
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 \, res)
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 enddef
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
224 def HasEval()
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
225 if has("eval")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
226 echo "yes"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
227 else
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
228 echo "no"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
229 endif
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
230 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
231
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
232 def HasNothing()
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
233 if has("nothing")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
234 echo "yes"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
235 else
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
236 echo "no"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
237 endif
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
238 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
239
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
240 def HasSomething()
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
241 if has("nothing")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
242 echo "nothing"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
243 elseif has("something")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
244 echo "something"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
245 elseif has("eval")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
246 echo "eval"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
247 elseif has("less")
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
248 echo "less"
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
249 endif
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
250 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
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_const_expr()
19332
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
253 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
254 let instr = execute('disassemble HasEval')
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
255 assert_match('HasEval.*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
256 \ .. 'if has("eval").*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
257 \ .. ' PUSHS "yes".*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
258 \, instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
259 assert_notmatch('JUMP', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
260
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
261 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
262 instr = execute('disassemble HasNothing')
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
263 assert_match('HasNothing.*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
264 \ .. 'if has("nothing").*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
265 \ .. 'else.*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
266 \ .. ' PUSHS "no".*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
267 \, instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
268 assert_notmatch('PUSHS "yes"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
269 assert_notmatch('JUMP', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
270
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
271 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
272 instr = execute('disassemble HasSomething')
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
273 assert_match('HasSomething.*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
274 \ .. 'if has("nothing").*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
275 \ .. 'elseif has("something").*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
276 \ .. 'elseif has("eval").*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
277 \ .. ' PUSHS "eval".*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
278 \ .. 'elseif has("less").*'
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
279 \, instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
280 assert_notmatch('PUSHS "nothing"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
281 assert_notmatch('PUSHS "something"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
282 assert_notmatch('PUSHS "less"', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
283 assert_notmatch('JUMP', instr)
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
284 enddef
d6e8a9e80be4 patch 8.2.0224: compiling :elseif not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19330
diff changeset
285
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
286 def WithLambda(): string
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
287 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
288 return F("x")
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
289 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
290
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
291 def Test_disassemble_lambda()
19334
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
292 assert_equal("XxX", WithLambda())
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
293 let instr = execute('disassemble WithLambda')
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
294 assert_match('WithLambda.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
295 \ .. '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
296 \ .. ' FUNCREF <lambda>\d\+.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
297 \ .. 'PUSHS "x".*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
298 \ .. ' LOAD $0.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
299 \ .. ' PCALL (argc 1).*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
300 \ .. ' CHECKTYPE string stack\[-1].*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
301 \, instr)
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
302 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
303
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
304 def AndOr(arg): string
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
305 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
306 return 'yes'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
307 endif
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
308 return 'no'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
309 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
310
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
311 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
312 assert_equal("yes", AndOr(1))
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
313 assert_equal("no", AndOr(2))
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
314 assert_equal("yes", AndOr(4))
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
315 let instr = execute('disassemble AndOr')
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
316 assert_match('AndOr.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
317 \ .. '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
318 \ .. '\d LOAD arg\[-1].*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
319 \ .. '\d PUSHNR 1.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
320 \ .. '\d COMPAREANY ==.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
321 \ .. '\d JUMP_AND_KEEP_IF_FALSE -> \d\+.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
322 \ .. '\d LOAD arg\[-1].*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
323 \ .. '\d PUSHNR 2.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
324 \ .. '\d COMPAREANY !=.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
325 \ .. '\d JUMP_AND_KEEP_IF_TRUE -> \d\+.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
326 \ .. '\d LOAD arg\[-1].*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
327 \ .. '\d PUSHNR 4.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
328 \ .. '\d COMPAREANY ==.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
329 \ .. '\d JUMP_IF_FALSE -> \d\+.*'
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
330 \, instr)
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
331 enddef
61646c189622 patch 8.2.0225: compiling lambda not tested yet
Bram Moolenaar <Bram@vim.org>
parents: 19332
diff changeset
332
19336
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
333 def ForLoop(): list<number>
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
334 let res: list<number>
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
335 for i in range(3)
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
336 res->add(i)
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
337 endfor
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
338 return res
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
339 enddef
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
340
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
341 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
342 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
343 let instr = execute('disassemble ForLoop')
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
344 assert_match('ForLoop.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
345 \ .. 'let res: list<number>.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
346 \ .. ' NEWLIST size 0.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
347 \ .. '\d STORE $0.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
348 \ .. 'for i in range(3).*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
349 \ .. '\d STORE -1 in $1.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
350 \ .. '\d PUSHNR 3.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
351 \ .. '\d BCALL range(argc 1).*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
352 \ .. '\d FOR $1 -> \d\+.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
353 \ .. '\d STORE $2.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
354 \ .. 'res->add(i).*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
355 \ .. '\d LOAD $0.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
356 \ .. '\d LOAD $2.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
357 \ .. '\d BCALL add(argc 2).*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
358 \ .. '\d DROP.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
359 \ .. 'endfor.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
360 \ .. '\d JUMP -> \d\+.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
361 \ .. '\d DROP.*'
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
362 \, instr)
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
363 enddef
1cd6eab65ce0 patch 8.2.0226: compiling for loop not tested
Bram Moolenaar <Bram@vim.org>
parents: 19334
diff changeset
364
19338
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
365 let g:number = 42
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
366
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
367 def Computing()
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
368 let nr = 3
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
369 let nrres = nr + 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
370 nrres = nr - 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
371 nrres = nr * 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
372 nrres = nr / 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
373 nrres = nr % 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
374
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
375 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
376 anyres = g:number - 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
377 anyres = g:number * 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
378 anyres = g:number / 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
379 anyres = g:number % 7
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
380
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
381 if has('float')
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
382 let fl = 3.0
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
383 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
384 flres = fl - 7.0
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
385 flres = fl * 7.0
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
386 flres = fl / 7.0
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
387 endif
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
388 enddef
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
389
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
390 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
391 let instr = execute('disassemble Computing')
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
392 assert_match('Computing.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
393 \ .. 'let nr = 3.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
394 \ .. '\d STORE 3 in $0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
395 \ .. 'let nrres = nr + 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
396 \ .. '\d LOAD $0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
397 \ .. '\d PUSHNR 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
398 \ .. '\d OPNR +.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
399 \ .. '\d STORE $1.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
400 \ .. 'nrres = nr - 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
401 \ .. '\d OPNR -.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
402 \ .. 'nrres = nr \* 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
403 \ .. '\d OPNR \*.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
404 \ .. 'nrres = nr / 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
405 \ .. '\d OPNR /.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
406 \ .. 'nrres = nr % 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
407 \ .. '\d OPNR %.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
408 \ .. '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
409 \ .. '\d LOADG g:number.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
410 \ .. '\d PUSHNR 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
411 \ .. '\d OPANY +.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
412 \ .. '\d STORE $2.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
413 \ .. 'anyres = g:number - 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
414 \ .. '\d OPANY -.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
415 \ .. 'anyres = g:number \* 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
416 \ .. '\d OPANY \*.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
417 \ .. 'anyres = g:number / 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
418 \ .. '\d OPANY /.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
419 \ .. 'anyres = g:number % 7.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
420 \ .. '\d OPANY %.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
421 \, instr)
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
422 if has('float')
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
423 assert_match('Computing.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
424 \ .. 'let fl = 3.0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
425 \ .. '\d PUSHF 3.0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
426 \ .. '\d STORE $3.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
427 \ .. '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
428 \ .. '\d LOAD $3.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
429 \ .. '\d PUSHF 7.0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
430 \ .. '\d OPFLOAT +.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
431 \ .. '\d STORE $4.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
432 \ .. 'flres = fl - 7.0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
433 \ .. '\d OPFLOAT -.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
434 \ .. 'flres = fl \* 7.0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
435 \ .. '\d OPFLOAT \*.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
436 \ .. 'flres = fl / 7.0.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
437 \ .. '\d OPFLOAT /.*'
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
438 \, instr)
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
439 endif
ef432264b88a patch 8.2.0227: compiling a few instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19336
diff changeset
440 enddef
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441
19439
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
442 def AddListBlob()
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
443 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
444 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
445 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
446
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
447 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
448 let instr = execute('disassemble AddListBlob')
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
449 assert_match('AddListBlob.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
450 \ .. '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
451 \ .. '\d PUSHNR 1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
452 \ .. '\d PUSHNR 2.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
453 \ .. '\d NEWLIST size 2.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
454 \ .. '\d PUSHNR 3.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
455 \ .. '\d PUSHNR 4.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
456 \ .. '\d NEWLIST size 2.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
457 \ .. '\d ADDLIST.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
458 \ .. '\d STORE $.*.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
459 \ .. '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
460 \ .. '\d PUSHBLOB 0z1122.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
461 \ .. '\d PUSHBLOB 0z3344.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
462 \ .. '\d ADDBLOB.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
463 \ .. '\d STORE $.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
464 \, instr)
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
465 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
466
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
467 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
468 def ConcatString(): string
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
469 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
470 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
471 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
472
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
473 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
474 let instr = execute('disassemble ConcatString')
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
475 assert_match('ConcatString.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
476 \ .. '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
477 \ .. '\d LOADG g:aa.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
478 \ .. '\d PUSHS "bb".*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
479 \ .. '\d 2STRING stack\[-2].*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
480 \ .. '\d CONCAT.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
481 \ .. '\d STORE $.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
482 \, instr)
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
483 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
484 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
485
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
486 def ListIndex(): number
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
487 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
488 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
489 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
490 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
491
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
492 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
493 let instr = execute('disassemble ListIndex')
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
494 assert_match('ListIndex.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
495 \ .. '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
496 \ .. '\d PUSHNR 1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
497 \ .. '\d PUSHNR 2.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
498 \ .. '\d PUSHNR 3.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
499 \ .. '\d NEWLIST size 3.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
500 \ .. '\d STORE $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
501 \ .. '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
502 \ .. '\d LOAD $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
503 \ .. '\d PUSHNR 1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
504 \ .. '\d INDEX.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
505 \ .. '\d STORE $1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
506 \, instr)
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
507 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
508 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
509
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
510 def DictMember(): number
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
511 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
512 let res = d.item
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
513 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
514 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
515
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
516 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
517 let instr = execute('disassemble DictMember')
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
518 assert_match('DictMember.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
519 \ .. '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
520 \ .. '\d PUSHS "item".*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
521 \ .. '\d PUSHNR 1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
522 \ .. '\d NEWDICT size 1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
523 \ .. '\d STORE $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
524 \ .. 'let res = d.item.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
525 \ .. '\d LOAD $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
526 \ .. '\d MEMBER item.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
527 \ .. '\d STORE $1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
528 \, instr)
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
529 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
530 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
531
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
532 def NegateNumber(): number
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
533 let nr = 9
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
534 let plus = +nr
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
535 let res = -nr
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
536 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
537 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
538
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
539 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
540 let instr = execute('disassemble NegateNumber')
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
541 assert_match('NegateNumber.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
542 \ .. 'let nr = 9.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
543 \ .. '\d STORE 9 in $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
544 \ .. 'let plus = +nr.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
545 \ .. '\d LOAD $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
546 \ .. '\d CHECKNR.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
547 \ .. '\d STORE $1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
548 \ .. 'let res = -nr.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
549 \ .. '\d LOAD $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
550 \ .. '\d NEGATENR.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
551 \ .. '\d STORE $2.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
552 \, instr)
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
553 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
554 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
555
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
556 def InvertBool(): bool
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
557 let flag = true
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
558 let invert = !flag
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
559 let res = !!flag
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
560 return res
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
561 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
562
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
563 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
564 let instr = execute('disassemble InvertBool')
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
565 assert_match('InvertBool.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
566 \ .. 'let flag = true.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
567 \ .. '\d PUSH v:true.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
568 \ .. '\d STORE $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
569 \ .. 'let invert = !flag.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
570 \ .. '\d LOAD $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
571 \ .. '\d INVERT (!val).*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
572 \ .. '\d STORE $1.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
573 \ .. 'let res = !!flag.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
574 \ .. '\d LOAD $0.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
575 \ .. '\d 2BOOL (!!val).*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
576 \ .. '\d STORE $2.*'
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
577 \, instr)
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
578 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
579 enddef
b347a6c61090 patch 8.2.0277: Vim9: not all instructions covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19390
diff changeset
580
19342
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
581 def Test_disassemble_compare()
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
582 " TODO: COMPAREFUNC
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
583 let cases = [
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
584 \ ['true == false', 'COMPAREBOOL =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
585 \ ['true != false', 'COMPAREBOOL !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
586 \ ['v:none == v:null', 'COMPARESPECIAL =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
587 \ ['v:none != v:null', 'COMPARESPECIAL !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
588 \
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
589 \ ['111 == 222', 'COMPARENR =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
590 \ ['111 != 222', 'COMPARENR !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
591 \ ['111 > 222', 'COMPARENR >'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
592 \ ['111 < 222', 'COMPARENR <'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
593 \ ['111 >= 222', 'COMPARENR >='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
594 \ ['111 <= 222', 'COMPARENR <='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
595 \ ['111 =~ 222', 'COMPARENR =\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
596 \ ['111 !~ 222', 'COMPARENR !\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
597 \
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
598 \ ['"xx" == "yy"', 'COMPARESTRING =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
599 \ ['"xx" != "yy"', 'COMPARESTRING !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
600 \ ['"xx" > "yy"', 'COMPARESTRING >'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
601 \ ['"xx" < "yy"', 'COMPARESTRING <'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
602 \ ['"xx" >= "yy"', 'COMPARESTRING >='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
603 \ ['"xx" <= "yy"', 'COMPARESTRING <='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
604 \ ['"xx" =~ "yy"', 'COMPARESTRING =\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
605 \ ['"xx" !~ "yy"', 'COMPARESTRING !\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
606 \ ['"xx" is "yy"', 'COMPARESTRING is'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
607 \ ['"xx" isnot "yy"', 'COMPARESTRING isnot'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
608 \
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
609 \ ['0z11 == 0z22', 'COMPAREBLOB =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
610 \ ['0z11 != 0z22', 'COMPAREBLOB !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
611 \ ['0z11 is 0z22', 'COMPAREBLOB is'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
612 \ ['0z11 isnot 0z22', 'COMPAREBLOB isnot'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
613 \
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
614 \ ['[1,2] == [3,4]', 'COMPARELIST =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
615 \ ['[1,2] != [3,4]', 'COMPARELIST !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
616 \ ['[1,2] is [3,4]', 'COMPARELIST is'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
617 \ ['[1,2] isnot [3,4]', 'COMPARELIST isnot'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
618 \
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
619 \ ['#{a:1} == #{x:2}', 'COMPAREDICT =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
620 \ ['#{a:1} != #{x:2}', 'COMPAREDICT !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
621 \ ['#{a:1} is #{x:2}', 'COMPAREDICT is'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
622 \ ['#{a:1} isnot #{x:2}', 'COMPAREDICT isnot'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
623 \
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
624 \ ['{->33} == {->44}', 'COMPAREPARTIAL =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
625 \ ['{->33} != {->44}', 'COMPAREPARTIAL !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
626 \ ['{->33} is {->44}', 'COMPAREPARTIAL is'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
627 \ ['{->33} isnot {->44}', 'COMPAREPARTIAL isnot'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
628 \
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
629 \ ['77 == g:xx', 'COMPAREANY =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
630 \ ['77 != g:xx', 'COMPAREANY !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
631 \ ['77 > g:xx', 'COMPAREANY >'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
632 \ ['77 < g:xx', 'COMPAREANY <'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
633 \ ['77 >= g:xx', 'COMPAREANY >='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
634 \ ['77 <= g:xx', 'COMPAREANY <='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
635 \ ['77 =~ g:xx', 'COMPAREANY =\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
636 \ ['77 !~ g:xx', 'COMPAREANY !\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
637 \ ['77 is g:xx', 'COMPAREANY is'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
638 \ ['77 isnot g:xx', 'COMPAREANY isnot'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
639 \ ]
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
640 if has('float')
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
641 cases->extend([
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
642 \ ['1.1 == 2.2', 'COMPAREFLOAT =='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
643 \ ['1.1 != 2.2', 'COMPAREFLOAT !='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
644 \ ['1.1 > 2.2', 'COMPAREFLOAT >'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
645 \ ['1.1 < 2.2', 'COMPAREFLOAT <'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
646 \ ['1.1 >= 2.2', 'COMPAREFLOAT >='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
647 \ ['1.1 <= 2.2', 'COMPAREFLOAT <='],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
648 \ ['1.1 =~ 2.2', 'COMPAREFLOAT =\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
649 \ ['1.1 !~ 2.2', 'COMPAREFLOAT !\~'],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
650 \ ])
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
651 endif
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
652
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
653 let nr = 1
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
654 for case in cases
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
655 writefile(['def TestCase' .. nr .. '()',
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
656 \ ' if ' .. case[0],
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
657 \ ' echo 42'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
658 \ ' endif',
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
659 \ 'enddef'], 'Xdisassemble')
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
660 source Xdisassemble
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
661 let instr = execute('disassemble TestCase' .. nr)
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
662 assert_match('TestCase' .. nr .. '.*'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
663 \ .. 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
664 \ .. '\d \(PUSH\|FUNCREF\).*'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
665 \ .. '\d \(PUSH\|FUNCREF\|LOADG\).*'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
666 \ .. '\d ' .. case[1] .. '.*'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
667 \ .. '\d JUMP_IF_FALSE -> \d\+.*'
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
668 \, instr)
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
669
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
670 nr += 1
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
671 endfor
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
672
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
673 " delete('Xdisassemble')
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
674 enddef
8ff84bc1c89b patch 8.2.0229: compare instructions not tested
Bram Moolenaar <Bram@vim.org>
parents: 19338
diff changeset
675
19330
9c8b803fe598 patch 8.2.0223: some instructions not yet tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker