aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-08-30 12:27:44 +0900
committererw7 <erw7.github@gmail.com>2019-09-04 14:48:21 +0900
commitd3f1eb3024fa297c970a79dd24ef818e4aeb8525 (patch)
tree391b55d590a4f995bda0d96116c15af23a025008 /src/nvim/testdir
parent9db60b06a1d9b50b3ba6beb858eb0fd2c58571c4 (diff)
downloadrneovim-d3f1eb3024fa297c970a79dd24ef818e4aeb8525.tar.gz
rneovim-d3f1eb3024fa297c970a79dd24ef818e4aeb8525.tar.bz2
rneovim-d3f1eb3024fa297c970a79dd24ef818e4aeb8525.zip
vim-patch:8.1.1946: memory error when profiling a function without a script ID
Problem: Memory error when profiling a function without a script ID. Solution: Check for missing script ID. (closes vim/vim#4877) https://github.com/vim/vim/commit/163588005da3a240e49416093d0d0251951d60a1
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/screendump.vim0
-rw-r--r--src/nvim/testdir/test_options.vim2
-rw-r--r--src/nvim/testdir/test_profile.vim30
3 files changed, 31 insertions, 1 deletions
diff --git a/src/nvim/testdir/screendump.vim b/src/nvim/testdir/screendump.vim
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/nvim/testdir/screendump.vim
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index ffd344200b..f4f5cbca61 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -216,7 +216,7 @@ func Test_set_completion()
" Expand files and directories.
call feedkeys(":set tags=./\<C-A>\<C-B>\"\<CR>", 'tx')
- call assert_match('./samples/ ./sautest/ ./setup.vim ./shared.vim', @:)
+ call assert_match('./samples/ ./sautest/ ./screendump.vim ./setup.vim ./shared.vim', @:)
call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:)
diff --git a/src/nvim/testdir/test_profile.vim b/src/nvim/testdir/test_profile.vim
index 4037095ae5..7e853eeac3 100644
--- a/src/nvim/testdir/test_profile.vim
+++ b/src/nvim/testdir/test_profile.vim
@@ -3,6 +3,8 @@ if !has('profile')
finish
endif
+source screendump.vim
+
func Test_profile_func()
let lines = [
\ 'profile start Xprofile_func.log',
@@ -518,3 +520,31 @@ func Test_profdel_star()
call delete('Xprofile_file.vim')
call delete('Xprofile_file.log')
endfunc
+
+" When typing the function it won't have a script ID, test that this works.
+func Test_profile_typed_func()
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot run Vim in a terminal window'
+ endif
+
+ let lines =<< trim END
+ profile start XprofileTypedFunc
+ END
+ call writefile(lines, 'XtestProfile')
+ let buf = RunVimInTerminal('-S XtestProfile', #{})
+
+ call term_sendkeys(buf, ":func DoSomething()\<CR>"
+ \ .. "echo 'hello'\<CR>"
+ \ .. "endfunc\<CR>")
+ call term_sendkeys(buf, ":profile func DoSomething\<CR>")
+ call term_sendkeys(buf, ":call DoSomething()\<CR>")
+ call term_wait(buf, 200)
+ call StopVimInTerminal(buf)
+ let lines = readfile('XprofileTypedFunc')
+ call assert_equal("FUNCTION DoSomething()", lines[0])
+ call assert_equal("Called 1 time", lines[1])
+
+ " clean up
+ call delete('XprofileTypedFunc')
+ call delete('XtestProfile')
+endfunc