Functions | |
if (nargin==3) pattern | |
elseif (nargin==1||(nargin==2 &&test_warning)) pattern | |
endif | if (isempty(pattern)) pattern |
endif | if (nargout) ret |
endif | if (test_warning) lastwarn() |
warning ("on","quiet") | |
try | evalin ("caller", sprintf("%s;", code)) |
warning (state.state,"quiet") | |
if (isempty(err)) msg | |
else | err ([1:9, end]) |
if (!isempty(regexp(err, pattern,"once"))) return | |
end_try_catch endif | error (msg) |
endfunction | !fail ('[1, 2]*[2, 3]','nonconformant')%!fail("fail('[1 |
endfunction expected error < nonconformant > but got none | !fail ("fail('[1,2]*[2,3]','usage:')","expected error <usage:>\nbut got.*nonconformant")%!fail("warning('test warning')" |
!fail ('a *[2;3]', 'nonconformant')%!fail('a *[2 | |
Variables | |
function | ret |
endif | test_warning = (nargin > 1 && strcmp (pattern, "warning")) |
state = warning ("query", "quiet") | |
err = lastwarn () | |
endif | msg = sprintf ("expected warning <%s>\nbut got <%s>", pattern, err) |
endfunction | nonconformant |
endfunction expected error < nonconformant > but got none | warning |
usage | __pad16__ |
!fail | ( | 'a *' | [2;3], | |
'nonconformant' | ||||
) |
endfunction expected error<nonconformant> but got none !fail | ( | "fail('[1,2]*[2,3]','usage:')" | , | |
"expected error <usage:>\nbut got.*nonconformant" | ||||
) |
endfunction !fail | ( | '*' | [1, 2][2, 3], | |
'nonconformant' | ||||
) |
elseif | ( | nargin | = =1||(nargin==2 &&test_warning) |
) |
else err | ( | ) |
end_try_catch else try evalin | ( | "caller" | , | |
sprintf("%s;", code) | ||||
) |
if | ( | ! | isemptyregexp(err, pattern,"once") | ) |
if | ( | isempty(err) | ) |
endif if | ( | test_warning | ) |
endif if | ( | nargout | ) |
if | ( | nargin | = =3 |
) |
warning | ( | state. | state, | |
"quiet" | ||||
) |
warning | ( | "on" | , | |
"quiet" | ||||
) |
usage __pad16__ |
catch err = lastwarn () |
state = warning ("query", "quiet") |
endif test_warning = (nargin > 1 && strcmp (pattern, "warning")) |
usage warning |