Mercurial > hg > octave-nkf
changeset 16976:13affad7347c
test.m: Use the syntax "BLOCK_NAME failed" for error/warnings blocks.
* scripts/testfun/test.m: Use the syntax "BLOCK_NAME failed" for error/warnings
blocks in analogy with 'test failed' for %!test blocks.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 13 Jul 2013 14:45:17 -0700 |
parents | 47cc8e3d9183 |
children | 0d5d3e53255f |
files | scripts/testfun/test.m |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/test.m +++ b/scripts/testfun/test.m @@ -392,7 +392,11 @@ if (__id) __patstr = ["id=",__id]; else - __patstr = ["<",__pattern,">"]; + if (! strcmp (__pattern, '.')) + __patstr = ["<",__pattern,">"]; + else + __patstr = "an error"; + endif endif try eval (sprintf ("function __test__(%s)\n%s\nendfunction", @@ -410,7 +414,7 @@ try eval (sprintf ("__test__(%s);", __shared)); if (! __warning) - __msg = sprintf ("%sexpected %s but got no error\n", + __msg = sprintf ("%serror failed.\nExpected %s but got no error\n", __signal_fail, __patstr); else if (! isempty (__id)) @@ -422,10 +426,11 @@ endif warning (__warnstate.state, "quiet"); if (isempty (__err)) - __msg = sprintf ("%sexpected %s but got no warning\n", - __signal_fail, __patstr); + __msg = sprintf (["%swarning failed.\n" \ + "Expected %s but got no warning\n"], + __signal_fail, __patstr); elseif (__mismatch) - __msg = sprintf ("%sexpected %s but got %s\n", + __msg = sprintf ("%serror failed.\nExpected %s but got <%s>\n", __signal_fail, __patstr, __err); else __success = 1; @@ -442,10 +447,11 @@ endif warning (__warnstate.state, "quiet"); if (__warning) - __msg = sprintf ("%sexpected warning %s but got error %s\n", + __msg = sprintf (["%swarning failed.\n" \ + "Expected warning %s but got error <%s>\n"], __signal_fail, __patstr, __err); elseif (__mismatch) - __msg = sprintf ("%sexpected %s but got %s\n", + __msg = sprintf ("%serror failed.\nExpected %s but got <%s>\n", __signal_fail, __patstr, __err); else __success = 1;