Mercurial > vim
comparison src/testdir/test_vim9_disassemble.vim @ 21353:fb8c8fcb7b60 v8.2.1227
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Commit: https://github.com/vim/vim/commit/f5be8cdb77786f93c23237d7d8162feca92067e2
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 17 20:36:00 2020 +0200
patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing
Problem: Vim9: allowing both quoted and # comments is confusing.
Solution: Only support # comments in Vim9 script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 17 Jul 2020 20:45:06 +0200 |
parents | 883315e762b7 |
children | 62339482daab |
comparison
equal
deleted
inserted
replaced
21352:92c30752e9d2 | 21353:fb8c8fcb7b60 |
---|---|
461 '\d PUSHS "yes"\_s*' .. | 461 '\d PUSHS "yes"\_s*' .. |
462 '\d DCALL DefinedLater(argc 1)\_s*' .. | 462 '\d DCALL DefinedLater(argc 1)\_s*' .. |
463 '\d RETURN', | 463 '\d RETURN', |
464 res) | 464 res) |
465 | 465 |
466 " Calling the function will change UCALL into the faster DCALL | 466 # Calling the function will change UCALL into the faster DCALL |
467 assert_equal('yes', FuncWithForwardCall()) | 467 assert_equal('yes', FuncWithForwardCall()) |
468 | 468 |
469 res = execute('disass s:FuncWithForwardCall') | 469 res = execute('disass s:FuncWithForwardCall') |
470 assert_match('FuncWithForwardCall\_s*' .. | 470 assert_match('FuncWithForwardCall\_s*' .. |
471 'return g:DefinedLater("yes")\_s*' .. | 471 'return g:DefinedLater("yes")\_s*' .. |
1071 floatDecl = 'let aFloat = 2.2' | 1071 floatDecl = 'let aFloat = 2.2' |
1072 endif | 1072 endif |
1073 | 1073 |
1074 let nr = 1 | 1074 let nr = 1 |
1075 for case in cases | 1075 for case in cases |
1076 " declare local variables to get a non-constant with the right type | 1076 # declare local variables to get a non-constant with the right type |
1077 writefile(['def TestCase' .. nr .. '()', | 1077 writefile(['def TestCase' .. nr .. '()', |
1078 ' let isFalse = false', | 1078 ' let isFalse = false', |
1079 ' let isNull = v:null', | 1079 ' let isNull = v:null', |
1080 ' let aNumber = 222', | 1080 ' let aNumber = 222', |
1081 ' let aString = "yy"', | 1081 ' let aString = "yy"', |
1119 ' endif', | 1119 ' endif', |
1120 'enddef'], 'Xdisassemble') | 1120 'enddef'], 'Xdisassemble') |
1121 source Xdisassemble | 1121 source Xdisassemble |
1122 let instr = execute('disassemble TestCase' .. nr) | 1122 let instr = execute('disassemble TestCase' .. nr) |
1123 if case[1] | 1123 if case[1] |
1124 " condition true, "echo 42" executed | 1124 # condition true, "echo 42" executed |
1125 assert_match('TestCase' .. nr .. '.*' .. | 1125 assert_match('TestCase' .. nr .. '.*' .. |
1126 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*' .. | 1126 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*' .. |
1127 '\d PUSHNR 42.*' .. | 1127 '\d PUSHNR 42.*' .. |
1128 '\d ECHO 1.*' .. | 1128 '\d ECHO 1.*' .. |
1129 '\d PUSHNR 0.*' .. | 1129 '\d PUSHNR 0.*' .. |
1130 '\d RETURN.*', | 1130 '\d RETURN.*', |
1131 instr) | 1131 instr) |
1132 else | 1132 else |
1133 " condition false, function just returns | 1133 # condition false, function just returns |
1134 assert_match('TestCase' .. nr .. '.*' .. | 1134 assert_match('TestCase' .. nr .. '.*' .. |
1135 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '[ \n]*' .. | 1135 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '[ \n]*' .. |
1136 'echo 42[ \n]*' .. | 1136 'echo 42[ \n]*' .. |
1137 'endif[ \n]*' .. | 1137 'endif[ \n]*' .. |
1138 '\s*\d PUSHNR 0.*' .. | 1138 '\s*\d PUSHNR 0.*' .. |
1243 g:res_FuncOne = execute('disass FuncOne') | 1243 g:res_FuncOne = execute('disass FuncOne') |
1244 END | 1244 END |
1245 writefile(lines, 'Xdisassemble') | 1245 writefile(lines, 'Xdisassemble') |
1246 source Xdisassemble | 1246 source Xdisassemble |
1247 | 1247 |
1248 " check that the first function calls the second with DCALL | 1248 # check that the first function calls the second with DCALL |
1249 assert_match('\<SNR>\d*_FuncOne\_s*' .. | 1249 assert_match('\<SNR>\d*_FuncOne\_s*' .. |
1250 'return FuncTwo()\_s*' .. | 1250 'return FuncTwo()\_s*' .. |
1251 '\d DCALL <SNR>\d\+_FuncTwo(argc 0)\_s*' .. | 1251 '\d DCALL <SNR>\d\+_FuncTwo(argc 0)\_s*' .. |
1252 '\d RETURN', | 1252 '\d RETURN', |
1253 g:res_FuncOne) | 1253 g:res_FuncOne) |