Mercurial > hg > octave-shane
changeset 13075:386024135ce6
codesprint: Add test for onCleanup()
* onCleanup.cc: Add test for onCleanup()
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 03 Sep 2011 13:20:28 -0700 |
parents | 0b789a03bde1 |
children | 59def8890992 |
files | src/DLD-FUNCTIONS/onCleanup.cc |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/onCleanup.cc +++ b/src/DLD-FUNCTIONS/onCleanup.cc @@ -274,3 +274,19 @@ return retval; } + +/* + +%!test +%! old_wstate = warning ("query"); +%! unwind_protect +%! trigger = onCleanup (@() warning ("on", "__MY_WARNING__")); +%! warning ("off", "__MY_WARNING__"); +%! assert ((warning ("query", "__MY_WARNING__")).state, "off"); +%! clear trigger +%! assert ((warning ("query", "__MY_WARNING__")).state, "on"); +%! unwind_protect_cleanup +%! warning (old_wstate); +%! end_unwind_protect + +*/