# HG changeset patch # User Bram Moolenaar # Date 1613305803 -3600 # Node ID 949238ccbd50ac9b03d05cafff916a54d7a36ebd # Parent c0b1516010b6b21fe4a97abcd6d899f925149681 patch 8.2.2512: Vim9: compiling error test sometimes fails Commit: https://github.com/vim/vim/commit/03dfde2b5f81f06639ec8697cdd32ad50d8509fd Author: Bram Moolenaar Date: Sun Feb 14 13:17:22 2021 +0100 patch 8.2.2512: Vim9: compiling error test sometimes fails Problem: Vim9: compiling error test sometimes fails. Solution: use WaitForAssert() instead of sleeping for a bit. (Dominique Pell?, closes #7837) diff --git a/src/testdir/term_util.vim b/src/testdir/term_util.vim --- a/src/testdir/term_util.vim +++ b/src/testdir/term_util.vim @@ -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 diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -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) diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -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() diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2512, +/**/ 2511, /**/ 2510,