]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0854: no proper test for what 9.0.0846 fixes v9.0.0854
authorzeertzjq <zeertzjq@outlook.com>
Thu, 10 Nov 2022 13:21:34 +0000 (13:21 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 10 Nov 2022 13:21:34 +0000 (13:21 +0000)
Problem:    No proper test for what 9.0.0846 fixes.
Solution:   Run test in a terminal so that the hit-enter prompt can show up.
            (closes #11523)

src/testdir/test_assert.vim
src/version.c

index 42dd6a9d6a96924dd1978a3d660ebb8925bd4275..8222d0c06fe0ba7892bb8172a84d3ed6fe91edfa 100644 (file)
@@ -1,5 +1,8 @@
 " Test that the methods used for testing work.
 
+source check.vim
+source term_util.vim
+
 func Test_assert_false()
   call assert_equal(0, assert_false(0))
   call assert_equal(0, assert_false(v:false))
@@ -338,10 +341,21 @@ func Test_assert_fails_in_try_block()
   endtry
 endfunc
 
+" Test that assert_fails() in a timer does not cause a hit-enter prompt.
+" Requires using a terminal, in regular tests the hit-enter prompt won't be
+" triggered.
 func Test_assert_fails_in_timer()
-  " should not cause a hit-enter prompt, which isn't actually checked here
-  call timer_start(0, {-> assert_fails('call', 'E471:')})
-  sleep 10m
+  CheckRunVimInTerminal
+
+  let buf = RunVimInTerminal('', {'rows': 6})
+  let cmd = ":call timer_start(0, {-> assert_fails('call', 'E471:')})"
+  call term_sendkeys(buf, cmd)
+  call WaitForAssert({-> assert_equal(cmd, term_getline(buf, 6))})
+  call term_sendkeys(buf, "\<CR>")
+  call TermWait(buf, 100)
+  call assert_match('E471: Argument required', term_getline(buf, 6))
+
+  call StopVimInTerminal(buf)
 endfunc
 
 func Test_assert_beeps()
index 3b22d4e77b6fdb3f365850f886c4719ee36bbc52..a759a28592893b5de1e381c4e354d96529a73b27 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    854,
 /**/
     853,
 /**/