Mercurial > hg > octave-nkf
changeset 18166:c9b4d3177de3
Don't count expected failures as passed tests.
* test.m: count expected failures separately from passed tests
* __run_test_suite__.m: report expected failures and skipped
tests during progress
author | Carlo de Falco <cdf@users.sourceforge.net> |
---|---|
date | Mon, 23 Dec 2013 18:38:53 +0100 |
parents | d6aaf821cf8f |
children | 441121728230 |
files | scripts/testfun/__run_test_suite__.m scripts/testfun/test.m |
diffstat | 2 files changed, 27 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/__run_test_suite__.m +++ b/scripts/testfun/__run_test_suite__.m @@ -66,7 +66,7 @@ dsk += sk; endfor puts ("\nSummary:\n\n"); - nfail = dn - dp; + nfail = dn - dp - dxf; printf (" PASS %6d\n", dp); printf (" FAIL %6d\n", nfail); if (dxf > 0) @@ -116,16 +116,22 @@ endfunction function print_test_file_name (nm) - filler = repmat (".", 1, 55-length (nm)); + filler = repmat (".", 1, 52-length (nm)); printf (" %s %s", nm, filler); endfunction -function print_pass_fail (n, p) - if (n > 0) +function print_pass_fail (p, n, xf, sk) + if ((n + sk) > 0) printf (" PASS %4d/%-4d", p, n); - nfail = n - p; + nfail = n - p - xf; if (nfail > 0) - printf (" FAIL %d", nfail); + printf (" FAIL %-4d", nfail); + endif + if (sk > 0) + printf (" (SKIP %-4d)", sk); + endif + if (xf > 0) + printf (" (XFAIL %-4d)", xf); endif endif puts ("\n"); @@ -190,7 +196,7 @@ if (has_tests (ffnm)) print_test_file_name (nm); [p, n, xf, sk] = test (nm, "quiet", fid); - print_pass_fail (n, p); + print_pass_fail (p, n, xf, sk); files_with_tests(end+1) = ffnm; else files_with_no_tests(end+1) = ffnm; @@ -241,7 +247,7 @@ tmp = strrep (tmp, [topbuilddir, filesep], ""); print_test_file_name (tmp); [p, n, xf, sk] = test (f, "quiet", fid); - print_pass_fail (n, p); + print_pass_fail (p, n, xf, sk); dp += p; dn += n; dxf += xf;
--- a/scripts/testfun/test.m +++ b/scripts/testfun/test.m @@ -265,6 +265,7 @@ ## Assume the block will succeed. __success = 1; __msg = []; + __isxtest = 0; ### DEMO @@ -492,10 +493,17 @@ ### TEST - elseif (strcmp (__type, "test") || strcmp (__type, "xtest")) + elseif (strcmp (__type, "test")) __istest = 1; ## Code will be evaluated below. +### XTEST + + elseif (strcmp (__type, "xtest")) + __istest = 0; + __isxtest = 1; + ## Code will be evaluated below. + ### Comment block. elseif (strcmp (__block(1:1), "#")) @@ -529,6 +537,7 @@ if (strcmp (__type, "xtest")) __msg = sprintf ("%sknown failure\n%s", __signal_fail, lasterr ()); __xfail++; + __success = 0; else __msg = sprintf ("%stest failed\n%s", __signal_fail, lasterr ()); __success = 0; @@ -558,7 +567,7 @@ fflush (__fid); endif endif - if (__success == 0) + if (__success == 0 && !__isxtest) __all_success = 0; ## Stop after one error if not in batch mode. if (! __batch) @@ -571,8 +580,8 @@ return; endif endif - __tests += __istest; - __successes += __success * __istest; + __tests += (__istest || __isxtest); + __successes += __success * (__istest || __isxtest); endfor ## Clear any test functions created eval (__clear, "");