aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2020-01-06 06:52:52 -0800
committerGitHub <noreply@github.com>2020-01-06 06:52:52 -0800
commit83b0054b87f82583873a6e7ef291507c580618b1 (patch)
tree1e3e8c3ee47b084e774c65f16950350afbd7a1cf /src/nvim/testdir
parentfa9b057d356edb9de7c778d62aed8d2451de56fb (diff)
parent83083dd47b0c2880e4e1401f1c751013c533d57f (diff)
downloadrneovim-83b0054b87f82583873a6e7ef291507c580618b1.tar.gz
rneovim-83b0054b87f82583873a6e7ef291507c580618b1.tar.bz2
rneovim-83b0054b87f82583873a6e7ef291507c580618b1.zip
Merge #11674 'vim-patch:8.0.1786,8.1.{851,1308,1309,1579}'
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_autocmd.vim2
-rw-r--r--src/nvim/testdir/test_highlight.vim10
-rw-r--r--src/nvim/testdir/test_mapping.vim2
-rw-r--r--src/nvim/testdir/test_timers.vim31
4 files changed, 40 insertions, 5 deletions
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 275b053bc9..e3547aea5b 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -52,7 +52,7 @@ if has('timers')
au CursorHoldI * let g:triggered += 1
set updatetime=500
call job_start(has('win32') ? 'cmd /c echo:' : 'echo',
- \ {'exit_cb': {j, s -> timer_start(1000, 'ExitInsertMode')}})
+ \ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}})
call feedkeys('a', 'x!')
call assert_equal(1, g:triggered)
unlet g:triggered
diff --git a/src/nvim/testdir/test_highlight.vim b/src/nvim/testdir/test_highlight.vim
index d94eb7c3a2..a320e8edc8 100644
--- a/src/nvim/testdir/test_highlight.vim
+++ b/src/nvim/testdir/test_highlight.vim
@@ -591,3 +591,13 @@ func Test_cursorline_with_visualmode()
call StopVimInTerminal(buf)
call delete('Xtest_cursorline_with_visualmode')
endfunc
+
+" This test must come before the Test_cursorline test, as it appears this
+" defines the Normal highlighting group anyway.
+func Test_1_highlight_Normalgroup_exists()
+ " MS-Windows GUI sets the font
+ if !has('win32') || !has('gui_running')
+ let hlNormal = HighlightArgs('Normal')
+ call assert_match('hi Normal\s*clear', hlNormal)
+ endif
+endfunc
diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim
index 34e62e80e8..f14f292a92 100644
--- a/src/nvim/testdir/test_mapping.vim
+++ b/src/nvim/testdir/test_mapping.vim
@@ -287,7 +287,7 @@ func Test_map_timeout_with_timer_interrupt()
set timeout timeoutlen=200
func ExitCb(job, status)
- let g:timer = timer_start(1, {_ -> feedkeys("3\<Esc>", 't')})
+ let g:timer = timer_start(1, {-> feedkeys("3\<Esc>", 't')})
endfunc
call job_start([&shell, &shellcmdflag, 'echo'], {'exit_cb': 'ExitCb'})
diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim
index 6c336e6fa6..3043103270 100644
--- a/src/nvim/testdir/test_timers.vim
+++ b/src/nvim/testdir/test_timers.vim
@@ -254,15 +254,14 @@ func Test_peek_and_get_char()
endfunc
func Test_getchar_zero()
- if has('win32')
+ if has('win32') && !has('gui_running')
" Console: no low-level input
- " GUI: somehow doesn't work
return
endif
" Measure the elapsed time to avoid a hang when it fails.
let start = reltime()
- let id = timer_start(20, {id -> feedkeys('x', 'L')})
+ let id = timer_start(20, {-> feedkeys('x', 'L')})
let c = 0
while c == 0 && reltimefloat(reltime(start)) < 0.2
let c = getchar(0)
@@ -314,4 +313,30 @@ func Test_restore_count()
call delete('Xtrctext')
endfunc
+" Test that the garbage collector isn't triggered if a timer callback invokes
+" vgetc().
+func Test_nocatch_garbage_collect()
+ " skipped: Nvim does not support test_garbagecollect_soon(), test_override()
+ return
+ " 'uptimetime. must be bigger than the timer timeout
+ set ut=200
+ call test_garbagecollect_soon()
+ call test_override('no_wait_return', 0)
+ func CauseAnError(id)
+ " This will show an error and wait for Enter.
+ let a = {'foo', 'bar'}
+ endfunc
+ func FeedChar(id)
+ call feedkeys('x', 't')
+ endfunc
+ call timer_start(300, 'FeedChar')
+ call timer_start(100, 'CauseAnError')
+ let x = getchar()
+
+ set ut&
+ call test_override('no_wait_return', 1)
+ delfunc CauseAnError
+ delfunc FeedChar
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab