diff src/testdir/test_vimscript.vim @ 11543:57c452316da1 v8.0.0654

patch 8.0.0654: no warning for text after :endfunction commit https://github.com/vim/vim/commit/663bb2331626944cea156374858131fcd323b9e9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 22 19:12:10 2017 +0200 patch 8.0.0654: no warning for text after :endfunction Problem: Text found after :endfunction is silently ignored. Solution: Give a warning if 'verbose' is set. When | or \n are used, execute the text as a command.
author Christian Brabandt <cb@256bit.org>
date Thu, 22 Jun 2017 19:15:04 +0200
parents 5be73ebf6a15
children 1780e6fecb30
line wrap: on
line diff
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -1363,6 +1363,33 @@ func Test_bitwise_functions()
     call assert_fails("call invert({})", 'E728:')
 endfunc
 
+" Test trailing text after :endfunction				    {{{1
+func Test_endfunction_trailing()
+    call assert_false(exists('*Xtest'))
+
+    exe "func Xtest()\necho 'hello'\nendfunc\nlet done = 'yes'"
+    call assert_true(exists('*Xtest'))
+    call assert_equal('yes', done)
+    delfunc Xtest
+    unlet done
+
+    exe "func Xtest()\necho 'hello'\nendfunc|let done = 'yes'"
+    call assert_true(exists('*Xtest'))
+    call assert_equal('yes', done)
+    delfunc Xtest
+    unlet done
+
+    set verbose=1
+    exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
+    call assert_true(exists('*Xtest'))
+    delfunc Xtest
+
+    call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946')
+    call assert_true(exists('*Xtest'))
+    delfunc Xtest
+    set verbose=0
+endfunc
+
 "-------------------------------------------------------------------------------
 " Modelines								    {{{1
 " vim: ts=8 sw=4 tw=80 fdm=marker