From 52778d62fcf6521f9a2b844340951247599b7936 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:42:49 +0100 Subject: 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. --- src/nvim/testdir/test_vimscript.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/nvim/testdir/test_vimscript.vim') 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 -- cgit From a185ab70fd2eb8d55f1156cf7d5513338a309917 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:45:11 +0100 Subject: vim-patch:8.0.0655: not easy to make sure a function does not exist Problem: Not easy to make sure a function does not exist. Solution: Add ! as an optional argument to :delfunc. https://github.com/vim/vim/commit/d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa --- src/nvim/testdir/test_vimscript.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir/test_vimscript.vim') diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index 78fe62bc63..f48b33e4d1 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1242,6 +1242,16 @@ func Test_endfunction_trailing() set verbose=0 endfunc +func Test_delfunction_force() + delfunc! Xtest + delfunc! Xtest + func Xtest() + echo 'nothing' + endfunc + delfunc! Xtest + delfunc! Xtest +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker -- cgit From a5d33d5e904d217d84171d7edcbb640cca73303a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:55:27 +0100 Subject: vim-patch:8.0.0656: cannot use ! after some user commands [Test passes, and the code change doesn't look applicable. So this only includes the test.] Problem: Cannot use ! after some user commands. Solution: Properly check for existing command. (Higashi Higashi) https://github.com/vim/vim/commit/6f9a476b2f2f0bb5c50d703ec4fc535ffd5bfe8f --- src/nvim/testdir/test_vimscript.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir/test_vimscript.vim') diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index f48b33e4d1..b18c2f5a85 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1252,6 +1252,15 @@ func Test_delfunction_force() delfunc! Xtest endfunc +" Test using bang after user command {{{1 +func Test_user_command_with_bang() + command -bang Nieuw let nieuw = 1 + Ni! + call assert_equal(1, nieuw) + unlet nieuw + delcommand Nieuw +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker -- cgit From d6cbe6ca875f0f20b02a373b6d039328f402a2c4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 12:16:55 +0100 Subject: vim-patch:8.0.0667: more tests for :endfunc [Only the test is merged; code was addressed by 60c025267265.] Problem: Memory access error when command follows :endfunction. (Nikolai Pavlov) Solution: Make memory handling in :function straightforward. (closes vim/vim#1793) https://github.com/vim/vim/commit/53564f7c1a2998d92568e07fff1f2a4c1cecb646 --- src/nvim/testdir/test_vimscript.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir/test_vimscript.vim') diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index b18c2f5a85..c449fc91b0 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1231,6 +1231,11 @@ func Test_endfunction_trailing() delfunc Xtest unlet done + " trailing line break + exe "func Xtest()\necho 'hello'\nendfunc\n" + call assert_true(exists('*Xtest')) + delfunc Xtest + set verbose=1 exe "func Xtest()\necho 'hello'\nendfunc \" garbage" call assert_true(exists('*Xtest')) @@ -1240,6 +1245,11 @@ func Test_endfunction_trailing() call assert_true(exists('*Xtest')) delfunc Xtest set verbose=0 + + function Foo() + echo 'hello' + endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' + delfunc Foo endfunc func Test_delfunction_force() -- cgit