mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.1366: test 49 is old style
Problem: Test 49 is old style. Solution: Convert several tests to new style. (Yegappan Lakshmanan, closes #6629)
This commit is contained in:
69
src/testdir/script_util.vim
Normal file
69
src/testdir/script_util.vim
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
" Functions shared by the tests for Vim Script
|
||||||
|
|
||||||
|
" Commands to track the execution path of a script
|
||||||
|
com! XpathINIT let g:Xpath = ''
|
||||||
|
com! -nargs=1 -bar Xpath let g:Xpath ..= <args>
|
||||||
|
com! XloopINIT let g:Xloop = 1
|
||||||
|
com! -nargs=1 -bar Xloop let g:Xpath ..= <args> .. g:Xloop
|
||||||
|
com! XloopNEXT let g:Xloop += 1
|
||||||
|
|
||||||
|
" MakeScript() - Make a script file from a function. {{{2
|
||||||
|
"
|
||||||
|
" Create a script that consists of the body of the function a:funcname.
|
||||||
|
" Replace any ":return" by a ":finish", any argument variable by a global
|
||||||
|
" variable, and every ":call" by a ":source" for the next following argument
|
||||||
|
" in the variable argument list. This function is useful if similar tests are
|
||||||
|
" to be made for a ":return" from a function call or a ":finish" in a script
|
||||||
|
" file.
|
||||||
|
func MakeScript(funcname, ...)
|
||||||
|
let script = tempname()
|
||||||
|
execute "redir! >" . script
|
||||||
|
execute "function" a:funcname
|
||||||
|
redir END
|
||||||
|
execute "edit" script
|
||||||
|
" Delete the "function" and the "endfunction" lines. Do not include the
|
||||||
|
" word "function" in the pattern since it might be translated if LANG is
|
||||||
|
" set. When MakeScript() is being debugged, this deletes also the debugging
|
||||||
|
" output of its line 3 and 4.
|
||||||
|
exec '1,/.*' . a:funcname . '(.*)/d'
|
||||||
|
/^\d*\s*endfunction\>/,$d
|
||||||
|
%s/^\d*//e
|
||||||
|
%s/return/finish/e
|
||||||
|
%s/\<a:\(\h\w*\)/g:\1/ge
|
||||||
|
normal gg0
|
||||||
|
let cnt = 0
|
||||||
|
while search('\<call\s*\%(\u\|s:\)\w*\s*(.*)', 'W') > 0
|
||||||
|
let cnt = cnt + 1
|
||||||
|
s/\<call\s*\%(\u\|s:\)\w*\s*(.*)/\='source ' . a:{cnt}/
|
||||||
|
endwhile
|
||||||
|
g/^\s*$/d
|
||||||
|
write
|
||||||
|
bwipeout
|
||||||
|
return script
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" ExecAsScript - Source a temporary script made from a function. {{{2
|
||||||
|
"
|
||||||
|
" Make a temporary script file from the function a:funcname, ":source" it, and
|
||||||
|
" delete it afterwards. However, if an exception is thrown the file may remain,
|
||||||
|
" the caller should call DeleteTheScript() afterwards.
|
||||||
|
let s:script_name = ''
|
||||||
|
function! ExecAsScript(funcname)
|
||||||
|
" Make a script from the function passed as argument.
|
||||||
|
let s:script_name = MakeScript(a:funcname)
|
||||||
|
|
||||||
|
" Source and delete the script.
|
||||||
|
exec "source" s:script_name
|
||||||
|
call delete(s:script_name)
|
||||||
|
let s:script_name = ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! DeleteTheScript()
|
||||||
|
if s:script_name
|
||||||
|
call delete(s:script_name)
|
||||||
|
let s:script_name = ''
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>)
|
||||||
|
|
@@ -1,25 +1,4 @@
|
|||||||
Results of test49.vim:
|
Results of test49.vim:
|
||||||
*** Test 18: OK (67224583)
|
|
||||||
*** Test 19: OK (69275973)
|
|
||||||
*** Test 20: OK (1874575085)
|
|
||||||
*** Test 21: OK (147932225)
|
|
||||||
*** Test 22: OK (4161)
|
|
||||||
*** Test 23: OK (49)
|
|
||||||
*** Test 24: OK (41)
|
|
||||||
*** Test 27: OK (1996459)
|
|
||||||
*** Test 28: OK (1996459)
|
|
||||||
*** Test 29: OK (170428555)
|
|
||||||
*** Test 30: OK (190905173)
|
|
||||||
*** Test 31: OK (190905173)
|
|
||||||
*** Test 34: OK (2146584868)
|
|
||||||
*** Test 35: OK (2146584868)
|
|
||||||
*** Test 36: OK (1071644672)
|
|
||||||
*** Test 37: OK (1071644672)
|
|
||||||
*** Test 38: OK (357908480)
|
|
||||||
*** Test 39: OK (357908480)
|
|
||||||
*** Test 40: OK (357908480)
|
|
||||||
*** Test 49: OK (179000669)
|
|
||||||
*** Test 50: OK (363550045)
|
|
||||||
*** Test 52: OK (1247112011)
|
*** Test 52: OK (1247112011)
|
||||||
*** Test 53: OK (131071)
|
*** Test 53: OK (131071)
|
||||||
*** Test 54: OK (2047)
|
*** Test 54: OK (2047)
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -754,6 +754,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 */
|
||||||
|
/**/
|
||||||
|
1366,
|
||||||
/**/
|
/**/
|
||||||
1365,
|
1365,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user