aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_vimscript.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-10-19 15:23:14 -0700
committerGitHub <noreply@github.com>2019-10-19 15:23:14 -0700
commit06a6828f01638d7f1fed012b494d93eb5f1c206d (patch)
tree3af4c60ce6701ddcdb434c0d31fbb0c6596db2f3 /src/nvim/testdir/test_vimscript.vim
parent93fe30593b47fe98a31c6bb67f4d6effb8b725fe (diff)
parent76f548a4765a95ee728ec65b84b8032170b483eb (diff)
downloadrneovim-06a6828f01638d7f1fed012b494d93eb5f1c206d.tar.gz
rneovim-06a6828f01638d7f1fed012b494d93eb5f1c206d.tar.bz2
rneovim-06a6828f01638d7f1fed012b494d93eb5f1c206d.zip
Merge #11211 from jbradaric/vim-8.1.1585
vim-patch:8.1.{1585,1625,1723,1729}
Diffstat (limited to 'src/nvim/testdir/test_vimscript.vim')
-rw-r--r--src/nvim/testdir/test_vimscript.vim70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim
index f39e53d6dd..3fcba4134e 100644
--- a/src/nvim/testdir/test_vimscript.vim
+++ b/src/nvim/testdir/test_vimscript.vim
@@ -1409,6 +1409,76 @@ func Test_compound_assignment_operators()
let @/ = ''
endfunc
+func Test_function_defined_line()
+ if has('gui_running')
+ " Can't catch the output of gvim.
+ return
+ endif
+
+ let lines =<< trim [CODE]
+ " F1
+ func F1()
+ " F2
+ func F2()
+ "
+ "
+ "
+ return
+ endfunc
+ " F3
+ execute "func F3()\n\n\n\nreturn\nendfunc"
+ " F4
+ execute "func F4()\n
+ \\n
+ \\n
+ \\n
+ \return\n
+ \endfunc"
+ endfunc
+ " F5
+ execute "func F5()\n\n\n\nreturn\nendfunc"
+ " F6
+ execute "func F6()\n
+ \\n
+ \\n
+ \\n
+ \return\n
+ \endfunc"
+ call F1()
+ verbose func F1
+ verbose func F2
+ verbose func F3
+ verbose func F4
+ verbose func F5
+ verbose func F6
+ qall!
+ [CODE]
+
+ call writefile(lines, 'Xtest.vim')
+ let res = system(v:progpath .. ' --clean -es -X -S Xtest.vim')
+ call assert_equal(0, v:shell_error)
+
+ let m = matchstr(res, 'function F1()[^[:print:]]*[[:print:]]*')
+ call assert_match(' line 2$', m)
+
+ let m = matchstr(res, 'function F2()[^[:print:]]*[[:print:]]*')
+ call assert_match(' line 4$', m)
+
+ let m = matchstr(res, 'function F3()[^[:print:]]*[[:print:]]*')
+ call assert_match(' line 11$', m)
+
+ let m = matchstr(res, 'function F4()[^[:print:]]*[[:print:]]*')
+ call assert_match(' line 13$', m)
+
+ let m = matchstr(res, 'function F5()[^[:print:]]*[[:print:]]*')
+ call assert_match(' line 21$', m)
+
+ let m = matchstr(res, 'function F6()[^[:print:]]*[[:print:]]*')
+ call assert_match(' line 23$', m)
+
+ call delete('Xtest.vim')
+endfunc
+
"-------------------------------------------------------------------------------
" Modelines {{{1
" vim: ts=8 sw=4 tw=80 fdm=marker