]> granicus.if.org Git - vim/commitdiff
patch 8.2.2512: Vim9: compiling error test sometimes fails v8.2.2512
authorBram Moolenaar <Bram@vim.org>
Sun, 14 Feb 2021 12:17:22 +0000 (13:17 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 14 Feb 2021 12:17:22 +0000 (13:17 +0100)
Problem:    Vim9: compiling error test sometimes fails.
Solution:   use WaitForAssert() instead of sleeping for a bit. (Dominique
            PellĂ©, closes #7837)

src/testdir/term_util.vim
src/testdir/test_vim9_func.vim
src/testdir/test_vim9_script.vim
src/version.c

index cfc850ba00a9c189ca128d065a7009ed4f57c66b..8541ef353bb225e049b3452d27419961022acb71 100644 (file)
@@ -179,5 +179,9 @@ func Run_shell_in_terminal(options)
   return buf
 endfunc
 
+" Return concatenated lines in terminal.
+func Term_getlines(buf, lines)
+  return join(map(a:lines, 'term_getline(a:buf, v:val)'), '')
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
index 4bcd974e50847415e0462f7512ff6f483765efbd..c24d32f93382ab504d9d0689590eaa69c5f4d8b2 100644 (file)
@@ -31,18 +31,8 @@ def TestCompilingError()
   call writefile(lines, 'XTest_compile_error')
   var buf = RunVimInTerminal('-S XTest_compile_error',
               {rows: 10, wait_for_ruler: 0})
-  var text = ''
-  for loop in range(100)
-    text = ''
-    for i in range(1, 9)
-      text ..= term_getline(buf, i)
-    endfor
-    if text =~ 'Variable not found: nothing'
-      break
-    endif
-    sleep 20m
-  endfor
-  assert_match('Error detected while compiling command line.*Fails.*Variable not found: nothing', text)
+  call WaitForAssert(() => assert_match('Error detected while compiling command line.*Fails.*Variable not found: nothing',
+                     Term_getlines(buf, range(1, 9))))
 
   # clean up
   call StopVimInTerminal(buf)
index 85eea13fdd7ba076f7ce9b7b6ceeea8769c97b06..996c357c52d29714e7a8320acad6b4caeeea3f5a 100644 (file)
@@ -755,7 +755,7 @@ def Test_throw_vimscript()
 enddef
 
 def Test_error_in_nested_function()
-  # an error in a nested :function aborts executin in the calling :def function
+  # an error in a nested :function aborts executing in the calling :def function
   var lines =<< trim END
       vim9script
       def Func()
index c9118223414ad74be33a05b1626cf0b8aa928fa2..dabc2af706a5d5fcf6c02cee578f8a059c954c07 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2512,
 /**/
     2511,
 /**/