0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 8.2.0227: compiling a few instructions not tested

Problem:    Compiling a few instructions not tested.
Solution:   Add more test cases.
This commit is contained in:
Bram Moolenaar
2020-02-06 22:41:16 +01:00
parent 04d0522046
commit c2a4b35b86
2 changed files with 80 additions and 1 deletions

View File

@@ -106,7 +106,7 @@ def s:ScriptFuncTry()
catch /fail/ catch /fail/
echo 'no' echo 'no'
finally finally
echo 'end' throw 'end'
endtry endtry
enddef enddef
@@ -124,6 +124,7 @@ def Test_disassembleTry()
\ .. ' CATCH.*' \ .. ' CATCH.*'
\ .. 'finally.*' \ .. 'finally.*'
\ .. ' PUSHS "end".*' \ .. ' PUSHS "end".*'
\ .. ' THROW.*'
\ .. 'endtry.*' \ .. 'endtry.*'
\ .. ' ENDTRY.*' \ .. ' ENDTRY.*'
\, res) \, res)
@@ -357,5 +358,81 @@ def Test_compile_for_loop()
\, instr) \, instr)
enddef enddef
let g:number = 42
def Computing()
let nr = 3
let nrres = nr + 7
nrres = nr - 7
nrres = nr * 7
nrres = nr / 7
nrres = nr % 7
let anyres = g:number + 7
anyres = g:number - 7
anyres = g:number * 7
anyres = g:number / 7
anyres = g:number % 7
if has('float')
let fl = 3.0
let flres = fl + 7.0
flres = fl - 7.0
flres = fl * 7.0
flres = fl / 7.0
endif
enddef
def Test_computing()
let instr = execute('disassemble Computing')
assert_match('Computing.*'
\ .. 'let nr = 3.*'
\ .. '\d STORE 3 in $0.*'
\ .. 'let nrres = nr + 7.*'
\ .. '\d LOAD $0.*'
\ .. '\d PUSHNR 7.*'
\ .. '\d OPNR +.*'
\ .. '\d STORE $1.*'
\ .. 'nrres = nr - 7.*'
\ .. '\d OPNR -.*'
\ .. 'nrres = nr \* 7.*'
\ .. '\d OPNR \*.*'
\ .. 'nrres = nr / 7.*'
\ .. '\d OPNR /.*'
\ .. 'nrres = nr % 7.*'
\ .. '\d OPNR %.*'
\ .. 'let anyres = g:number + 7.*'
\ .. '\d LOADG g:number.*'
\ .. '\d PUSHNR 7.*'
\ .. '\d OPANY +.*'
\ .. '\d STORE $2.*'
\ .. 'anyres = g:number - 7.*'
\ .. '\d OPANY -.*'
\ .. 'anyres = g:number \* 7.*'
\ .. '\d OPANY \*.*'
\ .. 'anyres = g:number / 7.*'
\ .. '\d OPANY /.*'
\ .. 'anyres = g:number % 7.*'
\ .. '\d OPANY %.*'
\, instr)
if has('float')
assert_match('Computing.*'
\ .. 'let fl = 3.0.*'
\ .. '\d PUSHF 3.0.*'
\ .. '\d STORE $3.*'
\ .. 'let flres = fl + 7.0.*'
\ .. '\d LOAD $3.*'
\ .. '\d PUSHF 7.0.*'
\ .. '\d OPFLOAT +.*'
\ .. '\d STORE $4.*'
\ .. 'flres = fl - 7.0.*'
\ .. '\d OPFLOAT -.*'
\ .. 'flres = fl \* 7.0.*'
\ .. '\d OPFLOAT \*.*'
\ .. 'flres = fl / 7.0.*'
\ .. '\d OPFLOAT /.*'
\, instr)
endif
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

View File

@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
227,
/**/ /**/
226, 226,
/**/ /**/