mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 14:58:18 +00:00
vim-patch:8.0.0477
Problem: The client-server test may hang when failing.
Solution: Set a timer. Add assert_report()
42205551b1
This commit is contained in:
@@ -1936,16 +1936,23 @@ argidx() Number current index in the argument list
|
|||||||
arglistid([{winnr} [, {tabnr}]]) Number argument list id
|
arglistid([{winnr} [, {tabnr}]]) Number argument list id
|
||||||
argv({nr}) String {nr} entry of the argument list
|
argv({nr}) String {nr} entry of the argument list
|
||||||
argv() List the argument list
|
argv() List the argument list
|
||||||
assert_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
|
assert_equal({exp}, {act} [, {msg}])
|
||||||
assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
|
none assert {exp} is equal to {act}
|
||||||
assert_fails( {cmd} [, {error}]) none assert {cmd} fails
|
assert_exception({error} [, {msg}])
|
||||||
assert_false({actual} [, {msg}]) none assert {actual} is false
|
none assert {error} is in v:exception
|
||||||
|
assert_fails({cmd} [, {error}]) none assert {cmd} fails
|
||||||
|
assert_false({actual} [, {msg}])
|
||||||
|
none assert {actual} is false
|
||||||
assert_inrange({lower}, {upper}, {actual} [, {msg}])
|
assert_inrange({lower}, {upper}, {actual} [, {msg}])
|
||||||
none assert {actual} is inside the range
|
none assert {actual} is inside the range
|
||||||
assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
|
assert_match({pat}, {text} [, {msg}])
|
||||||
assert_notequal( {exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
|
none assert {pat} matches {text}
|
||||||
assert_notmatch( {pat}, {text} [, {msg}]) none assert {pat} not matches {text}
|
assert_notequal({exp}, {act} [, {msg}])
|
||||||
assert_true({actual} [, {msg}]) none assert {actual} is true
|
none assert {exp} is not equal {act}
|
||||||
|
assert_notmatch({pat}, {text} [, {msg}])
|
||||||
|
none assert {pat} not matches {text}
|
||||||
|
assert_report({msg}) none report a test failure
|
||||||
|
assert_true({actual} [, {msg}]) none assert {actual} is true
|
||||||
asin({expr}) Float arc sine of {expr}
|
asin({expr}) Float arc sine of {expr}
|
||||||
atan({expr}) Float arc tangent of {expr}
|
atan({expr}) Float arc tangent of {expr}
|
||||||
atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2}
|
atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2}
|
||||||
@@ -2501,6 +2508,9 @@ assert_notmatch({pattern}, {actual} [, {msg}])
|
|||||||
The opposite of `assert_match()`: add an error message to
|
The opposite of `assert_match()`: add an error message to
|
||||||
|v:errors| when {pattern} matches {actual}.
|
|v:errors| when {pattern} matches {actual}.
|
||||||
|
|
||||||
|
assert_report({msg}) *assert_report()*
|
||||||
|
Report a test failure directly, using {msg}.
|
||||||
|
|
||||||
assert_true({actual} [, {msg}]) *assert_true()*
|
assert_true({actual} [, {msg}]) *assert_true()*
|
||||||
When {actual} is not true an error message is added to
|
When {actual} is not true an error message is added to
|
||||||
|v:errors|, like with |assert_equal()|.
|
|v:errors|, like with |assert_equal()|.
|
||||||
@@ -3632,11 +3642,14 @@ foldtext() Returns a String, to be displayed for a closed fold. This is
|
|||||||
|v:foldstart|, |v:foldend| and |v:folddashes| variables.
|
|v:foldstart|, |v:foldend| and |v:folddashes| variables.
|
||||||
The returned string looks like this: >
|
The returned string looks like this: >
|
||||||
+-- 45 lines: abcdef
|
+-- 45 lines: abcdef
|
||||||
< The number of dashes depends on the foldlevel. The "45" is
|
< The number of leading dashes depends on the foldlevel. The
|
||||||
the number of lines in the fold. "abcdef" is the text in the
|
"45" is the number of lines in the fold. "abcdef" is the text
|
||||||
first non-blank line of the fold. Leading white space, "//"
|
in the first non-blank line of the fold. Leading white space,
|
||||||
or "/*" and the text from the 'foldmarker' and 'commentstring'
|
"//" or "/*" and the text from the 'foldmarker' and
|
||||||
options is removed.
|
'commentstring' options is removed.
|
||||||
|
When used to draw the actual foldtext, the rest of the line
|
||||||
|
will be filled with the fold char from the 'fillchars'
|
||||||
|
setting.
|
||||||
{not available when compiled without the |+folding| feature}
|
{not available when compiled without the |+folding| feature}
|
||||||
|
|
||||||
foldtextresult({lnum}) *foldtextresult()*
|
foldtextresult({lnum}) *foldtextresult()*
|
||||||
|
@@ -6807,6 +6807,17 @@ static void f_assert_notequal(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
assert_equal_common(argvars, ASSERT_NOTEQUAL);
|
assert_equal_common(argvars, ASSERT_NOTEQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// "assert_report(msg)
|
||||||
|
static void f_assert_report(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
|
{
|
||||||
|
garray_T ga;
|
||||||
|
|
||||||
|
prepare_assert_error(&ga);
|
||||||
|
ga_concat(&ga, (const char_u *)tv_get_string(&argvars[0]));
|
||||||
|
assert_error(&ga);
|
||||||
|
ga_clear(&ga);
|
||||||
|
}
|
||||||
|
|
||||||
/// "assert_exception(string[, msg])" function
|
/// "assert_exception(string[, msg])" function
|
||||||
static void f_assert_exception(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
static void f_assert_exception(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
{
|
{
|
||||||
|
@@ -33,6 +33,7 @@ return {
|
|||||||
assert_match={args={2, 3}},
|
assert_match={args={2, 3}},
|
||||||
assert_notequal={args={2, 3}},
|
assert_notequal={args={2, 3}},
|
||||||
assert_notmatch={args={2, 3}},
|
assert_notmatch={args={2, 3}},
|
||||||
|
assert_report={args=1},
|
||||||
assert_true={args={1, 2}},
|
assert_true={args={1, 2}},
|
||||||
atan={args=1, func="float_op_wrapper", data="&atan"},
|
atan={args=1, func="float_op_wrapper", data="&atan"},
|
||||||
atan2={args=2},
|
atan2={args=2},
|
||||||
|
@@ -76,7 +76,7 @@ set listchars=eol:$
|
|||||||
" Prevent Nvim log from writing to stderr.
|
" Prevent Nvim log from writing to stderr.
|
||||||
let $NVIM_LOG_FILE='Xnvim.log'
|
let $NVIM_LOG_FILE='Xnvim.log'
|
||||||
|
|
||||||
function RunTheTest(test)
|
func RunTheTest(test)
|
||||||
echo 'Executing ' . a:test
|
echo 'Executing ' . a:test
|
||||||
if exists("*SetUp")
|
if exists("*SetUp")
|
||||||
call SetUp()
|
call SetUp()
|
||||||
@@ -113,6 +113,60 @@ function RunTheTest(test)
|
|||||||
set nomodified
|
set nomodified
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func AfterTheTest()
|
||||||
|
if len(v:errors) > 0
|
||||||
|
let s:fail += 1
|
||||||
|
call add(s:errors, 'Found errors in ' . s:test . ':')
|
||||||
|
call extend(s:errors, v:errors)
|
||||||
|
let v:errors = []
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" This function can be called by a test if it wants to abort testing.
|
||||||
|
func FinishTesting()
|
||||||
|
call AfterTheTest()
|
||||||
|
|
||||||
|
" Don't write viminfo on exit.
|
||||||
|
set viminfo=
|
||||||
|
|
||||||
|
if s:fail == 0
|
||||||
|
" Success, create the .res file so that make knows it's done.
|
||||||
|
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
|
||||||
|
write
|
||||||
|
endif
|
||||||
|
|
||||||
|
if len(s:errors) > 0
|
||||||
|
" Append errors to test.log
|
||||||
|
split test.log
|
||||||
|
call append(line('$'), '')
|
||||||
|
call append(line('$'), 'From ' . g:testname . ':')
|
||||||
|
call append(line('$'), s:errors)
|
||||||
|
write
|
||||||
|
endif
|
||||||
|
|
||||||
|
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
|
||||||
|
echo message
|
||||||
|
call add(s:messages, message)
|
||||||
|
if s:fail > 0
|
||||||
|
let message = s:fail . ' FAILED:'
|
||||||
|
echo message
|
||||||
|
call add(s:messages, message)
|
||||||
|
call extend(s:messages, s:errors)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Add SKIPPED messages
|
||||||
|
call extend(s:messages, s:skipped)
|
||||||
|
|
||||||
|
" Append messages to the file "messages"
|
||||||
|
split messages
|
||||||
|
call append(line('$'), '')
|
||||||
|
call append(line('$'), 'From ' . g:testname . ':')
|
||||||
|
call append(line('$'), s:messages)
|
||||||
|
write
|
||||||
|
|
||||||
|
qall!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Source the test script. First grab the file name, in case the script
|
" Source the test script. First grab the file name, in case the script
|
||||||
" navigates away. g:testname can be used by the tests.
|
" navigates away. g:testname can be used by the tests.
|
||||||
let g:testname = expand('%')
|
let g:testname = expand('%')
|
||||||
@@ -157,56 +211,14 @@ for s:test in sort(s:tests)
|
|||||||
call RunTheTest(s:test)
|
call RunTheTest(s:test)
|
||||||
|
|
||||||
if len(v:errors) > 0 && index(s:flaky, s:test) >= 0
|
if len(v:errors) > 0 && index(s:flaky, s:test) >= 0
|
||||||
call add(s:messages, 'Flaky test failed, running it again')
|
call add(s:messages, 'Flaky test failed, running it again')
|
||||||
let v:errors = []
|
|
||||||
call RunTheTest(s:test)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if len(v:errors) > 0
|
|
||||||
let s:fail += 1
|
|
||||||
call add(s:errors, 'Found errors in ' . s:test . ':')
|
|
||||||
call extend(s:errors, v:errors)
|
|
||||||
let v:errors = []
|
let v:errors = []
|
||||||
|
call RunTheTest(s:test)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call AfterTheTest()
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" Don't write viminfo on exit.
|
call FinishTesting()
|
||||||
set viminfo=
|
|
||||||
|
|
||||||
if s:fail == 0
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
" Success, create the .res file so that make knows it's done.
|
|
||||||
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
|
|
||||||
write
|
|
||||||
endif
|
|
||||||
|
|
||||||
if len(s:errors) > 0
|
|
||||||
" Append errors to test.log
|
|
||||||
split test.log
|
|
||||||
call append(line('$'), '')
|
|
||||||
call append(line('$'), 'From ' . g:testname . ':')
|
|
||||||
call append(line('$'), s:errors)
|
|
||||||
write
|
|
||||||
endif
|
|
||||||
|
|
||||||
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests': ' test')
|
|
||||||
echo message
|
|
||||||
call add(s:messages, message)
|
|
||||||
if s:fail > 0
|
|
||||||
let message = s:fail . ' FAILED'
|
|
||||||
echo message
|
|
||||||
call add(s:messages, message)
|
|
||||||
call extend(s:messages, s:errors)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Add SKIPPED messages
|
|
||||||
call extend(s:messages, s:skipped)
|
|
||||||
|
|
||||||
" Append messages to the file "messages"
|
|
||||||
split messages
|
|
||||||
call append(line('$'), '')
|
|
||||||
call append(line('$'), 'From ' . g:testname . ':')
|
|
||||||
call append(line('$'), s:messages)
|
|
||||||
write
|
|
||||||
|
|
||||||
qall!
|
|
||||||
|
Reference in New Issue
Block a user