aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-01-21 11:42:49 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-01-21 18:42:44 +0100
commit52778d62fcf6521f9a2b844340951247599b7936 (patch)
treeea817ddf866e9f5f436785b1dd41310974404a3c
parent2820860ba35e09c719b91704cbb3cba37fb60cf3 (diff)
downloadrneovim-52778d62fcf6521f9a2b844340951247599b7936.tar.gz
rneovim-52778d62fcf6521f9a2b844340951247599b7936.tar.bz2
rneovim-52778d62fcf6521f9a2b844340951247599b7936.zip
vim-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. https://github.com/vim/vim/commit/663bb2331626944cea156374858131fcd323b9e9 Note: the code part of this patch was addressed by 60c025267265.
-rw-r--r--src/nvim/testdir/test_vimscript.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim
index 4e0f1bbd2f..78fe62bc63 100644
--- a/src/nvim/testdir/test_vimscript.vim
+++ b/src/nvim/testdir/test_vimscript.vim
@@ -1215,6 +1215,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