Mercurial > vim
diff src/testdir/test_vimscript.vim @ 15406:63b02fcf1361 v8.1.0711
patch 8.1.0711: test files still use function!
commit https://github.com/vim/vim/commit/1e1153600c0377472d62cc553173fe555ddcf5a7
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 9 23:01:02 2019 +0100
patch 8.1.0711: test files still use function!
Problem: Test files still use function!.
Solution: Remove the exclamation mark. Fix overwriting a function.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 09 Jan 2019 23:15:05 +0100 |
parents | 33a2277b8d4d |
children | 05d836c8f1c4 |
line wrap: on
line diff
--- a/src/testdir/test_vimscript.vim +++ b/src/testdir/test_vimscript.vim @@ -5,11 +5,11 @@ " Test environment {{{1 "------------------------------------------------------------------------------- -com! XpathINIT let g:Xpath = '' +com! XpathINIT let g:Xpath = '' com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . <args> " Append a message to the "messages" file -func! Xout(text) +func Xout(text) split messages $put =a:text wq @@ -25,7 +25,7 @@ com! -nargs=1 Xout call Xout(<a " 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. -function! MakeScript(funcname, ...) +func MakeScript(funcname, ...) let script = tempname() execute "redir! >" . script execute "function" a:funcname @@ -50,7 +50,7 @@ function! MakeScript(funcname, ...) write bwipeout return script -endfunction +endfunc " ExecAsScript - Source a temporary script made from a function. {{{2 " @@ -301,9 +301,9 @@ XpathINIT " let calls = "" com! -nargs=1 CALL - \ if !exists("calls") && !exists("outer") | - \ let g:calls = g:calls . <args> | - \ endif + \ if !exists("calls") && !exists("outer") | + \ let g:calls = g:calls . <args> | + \ endif let i = 0 while i < 3 @@ -357,7 +357,7 @@ endif if exists("*F1") call F1("F1") if exists("*G1") - call G1("G1") + call G1("G1") endif endif @@ -367,13 +367,13 @@ endif if exists("*F2") call F2(2, "F2") if exists("*G21") - call G21("G21") + call G21("G21") endif if exists("*G22") - call G22("G22") + call G22("G22") endif if exists("*G23") - call G23("G23") + call G23("G23") endif endif @@ -383,13 +383,13 @@ endif if exists("*F3") call F3(3, "F3") if exists("*G31") - call G31("G31") + call G31("G31") endif if exists("*G32") - call G32("G32") + call G32("G32") endif if exists("*G33") - call G33("G33") + call G33("G33") endif endif @@ -640,7 +640,7 @@ function! MSG(enr, emsg) endif endif return match -endfunction +endfunc if 1 || strlen("\"") | Xpath 'a' Xpath 'b' @@ -1032,11 +1032,11 @@ func Test_type() call assert_true(empty(v:none)) func ChangeYourMind() - try - return v:true - finally - return 'something else' - endtry + try + return v:true + finally + return 'something else' + endtry endfunc call ChangeYourMind() @@ -1250,70 +1250,70 @@ endfunction func Test_script_lines() " :append try - call DefineFunction('T_Append', [ - \ 'append', - \ 'py <<EOS', - \ '.', - \ ]) + call DefineFunction('T_Append', [ + \ 'append', + \ 'py <<EOS', + \ '.', + \ ]) catch - call assert_report("Can't define function") + call assert_report("Can't define function") endtry try - call DefineFunction('T_Append', [ - \ 'append', - \ 'abc', - \ ]) - call assert_report("Shouldn't be able to define function") + call DefineFunction('T_Append', [ + \ 'append', + \ 'abc', + \ ]) + call assert_report("Shouldn't be able to define function") catch - call assert_exception('Vim(function):E126: Missing :endfunction') + call assert_exception('Vim(function):E126: Missing :endfunction') endtry " :change try - call DefineFunction('T_Change', [ - \ 'change', - \ 'py <<EOS', - \ '.', - \ ]) + call DefineFunction('T_Change', [ + \ 'change', + \ 'py <<EOS', + \ '.', + \ ]) catch - call assert_report("Can't define function") + call assert_report("Can't define function") endtry try - call DefineFunction('T_Change', [ - \ 'change', - \ 'abc', - \ ]) - call assert_report("Shouldn't be able to define function") + call DefineFunction('T_Change', [ + \ 'change', + \ 'abc', + \ ]) + call assert_report("Shouldn't be able to define function") catch - call assert_exception('Vim(function):E126: Missing :endfunction') + call assert_exception('Vim(function):E126: Missing :endfunction') endtry " :insert try - call DefineFunction('T_Insert', [ - \ 'insert', - \ 'py <<EOS', - \ '.', - \ ]) + call DefineFunction('T_Insert', [ + \ 'insert', + \ 'py <<EOS', + \ '.', + \ ]) catch - call assert_report("Can't define function") + call assert_report("Can't define function") endtry try - call DefineFunction('T_Insert', [ - \ 'insert', - \ 'abc', - \ ]) - call assert_report("Shouldn't be able to define function") + call DefineFunction('T_Insert', [ + \ 'insert', + \ 'abc', + \ ]) + call assert_report("Shouldn't be able to define function") catch - call assert_exception('Vim(function):E126: Missing :endfunction') + call assert_exception('Vim(function):E126: Missing :endfunction') endtry endfunc "------------------------------------------------------------------------------- " Test 96: line continuation {{{1 " -" Undefined behavior was detected by ubsan with line continuation -" after an empty line. +" Undefined behavior was detected by ubsan with line continuation +" after an empty line. "------------------------------------------------------------------------------- func Test_script_emty_line_continuation()