summaryrefslogtreecommitdiff
path: root/src/testdir/test_timers.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-03 15:48:12 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-03 15:48:12 +0200
commit5e80de3f3e572805fe734b66bc42c13303ad9bdb (patch)
tree038a05f77d6493f69928517044d021f37ec19112 /src/testdir/test_timers.vim
parent00ccf54630dc68a9b8aedb92b268f3b697081f68 (diff)
downloadvim-git-5e80de3f3e572805fe734b66bc42c13303ad9bdb.tar.gz
patch 8.0.1048: no test for what 8.0.1020 fixesv8.0.1048
Problem: No test for what 8.0.1020 fixes. Solution: Add test_feedinput(). Add a test. (Ozaki Kiichi, closes #2046)
Diffstat (limited to 'src/testdir/test_timers.vim')
-rw-r--r--src/testdir/test_timers.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index d30325b7b..0c6bb8338 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -206,5 +206,24 @@ func Test_timer_errors()
call assert_equal(3, g:call_count)
endfunc
+func FeedAndPeek(timer)
+ call test_feedinput('a')
+ call getchar(1)
+endfunc
+
+func Interrupt(timer)
+ call test_feedinput("\<C-C>")
+endfunc
+
+func Test_peek_and_get_char()
+ if !has('unix') && !has('gui_running')
+ return
+ endif
+ call timer_start(0, 'FeedAndPeek')
+ let intr = timer_start(100, 'Interrupt')
+ let c = getchar()
+ call assert_equal(char2nr('a'), c)
+ call timer_stop(intr)
+endfunc
" vim: shiftwidth=2 sts=2 expandtab