changeset 33582:de14d508b8f9

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 13 May 2024 18:40:08 +0200
parents 3e446791b7ef (current diff) afbff609c241 (diff)
children 3fe954c2fd25
files
diffstat 1 files changed, 42 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/test/bug-53027/bug-53027.tst	Sun May 12 21:00:35 2024 -0400
+++ b/test/bug-53027/bug-53027.tst	Mon May 13 18:40:08 2024 +0200
@@ -15,42 +15,57 @@
 %! global X;
 %! X = 0;
 %! fname = tempname ();
-%! save53027 (fname);
-%! assert (X, 1);
-%! load53027 (fname);
-%! assert (X, 1);
-%! load53027 (fname);
-%! assert (X, 1);
-%! clear X
-%! assert (exist ("X"), 0);
-%! clear -global X;  # cleanup after test
-%! unlink (fname);  # remove temp file
+%! unwind_protect
+%!   save53027 (fname);
+%!   assert (X, 1);
+%!   load53027 (fname);
+%!   assert (X, 1);
+%!   load53027 (fname);
+%!   assert (X, 1);
+%!   clear X
+%!   assert (exist ("X"), 0);
+%! unwind_protect_cleanup
+%!   clear -global X;
+%!   unlink (fname);  # remove temp file
+%! end_unwind_protect
 
 %!test <*53027>
 %! [a, b] = ntest53027a ();
-%! assert ([a, b], [0, 0])
-%! clear -global x;  # cleanup after test
+%! unwind_protect
+%!   assert ([a, b], [0, 0])
+%! unwind_protect_cleanup
+%!   clear -global x;
+%! end_unwind_protect
 
 %!test <*53027>
 %! [a, b] = ntest53027b ();
-%! assert ([a, b], [0, 0])
-%! clear -global x;  # cleanup after test
+%! unwind_protect
+%!   assert ([a, b], [0, 0])
+%! unwind_protect_cleanup
+%!   clear -global x;
+%! end_unwind_protect
 
 %!test <*53027>
 %! [a, b] = ntest53027c ();
-%! assert ([a, b], [0, 0])
-%! clear -global x;  # cleanup after test
+%! unwind_protect
+%!   assert ([a, b], [0, 0])
+%! unwind_protect_cleanup
+%!   clear -global x;
+%! end_unwind_protect
 
 ## Previous bugs have caused segfaults when executing script twice.
 %!test <*53027>
-%! gtest53027
-%! assert (isempty (a) && isempty (c))
-%! assert (isglobal ("a") && isglobal ("c"))
-%! assert (! exist ("b"))
-%! assert (isempty (xx) && ! isglobal ("xx"))
-%! gtest53027
-%! assert (isempty (a) && isempty (c))
-%! assert (isglobal ("a") && isglobal ("c"))
-%! assert (! exist ("b"))
-%! assert (isempty (xx) && ! isglobal ("xx"))
-%! clear -global a b c;
+%! unwind_protect
+%!   gtest53027
+%!   assert (isempty (a) && isempty (c))
+%!   assert (isglobal ("a") && isglobal ("c"))
+%!   assert (! exist ("b"))
+%!   assert (isempty (xx) && ! isglobal ("xx"))
+%!   gtest53027
+%!   assert (isempty (a) && isempty (c))
+%!   assert (isglobal ("a") && isglobal ("c"))
+%!   assert (! exist ("b"))
+%!   assert (isempty (xx) && ! isglobal ("xx"))
+%! unwind_protect_cleanup
+%!   clear -global a b c;
+%! end_unwind_protect