summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-08-29 22:05:28 +0200
committerYves Orton <demerphq@gmail.com>2022-09-05 07:57:17 +0200
commit0a2c3307765fa93b7e275a0cc3c1112cd0a116eb (patch)
tree89eb031eee2293f1d8030ed8dde6ad0bfaa8b5b9 /t
parentc304acb49dada68ec331d50f8af45f0dda83ba6a (diff)
downloadperl-0a2c3307765fa93b7e275a0cc3c1112cd0a116eb.tar.gz
t/comp/retainedlines.t - test eval "UNITCHECK{die}" also
We test BEGIN{die}, but not UNITCHECK{die}. Lets do both.
Diffstat (limited to 't')
-rw-r--r--t/comp/retainedlines.t22
1 files changed, 21 insertions, 1 deletions
diff --git a/t/comp/retainedlines.t b/t/comp/retainedlines.t
index 2a846cecae..adc78ac31f 100644
--- a/t/comp/retainedlines.t
+++ b/t/comp/retainedlines.t
@@ -6,7 +6,7 @@
# we've not yet verified that use works.
# use strict;
-print "1..98\n";
+print "1..109\n";
my $test = 0;
sub failed {
@@ -165,6 +165,26 @@ for (0xA, 0) {
}
}
+for (0xA, 0) {
+ local $^P = $_;
+
+ eval (my $prog = "UNITCHECK{die}\n");
+ is (!!$@, 1, "Is \$@ true?");
+ is ($@=~/UNITCHECK failed--call queue aborted/, 1,
+ "Error is expected value?");
+
+ if ($_) {
+ check_retained_lines($prog, 'eval that defines UNITCHECK that dies');
+ }
+ else {
+ my @after = grep { /eval/ } keys %::;
+
+ is (scalar @after, 0 + keys %seen,
+ "evals with UNITCHECK{die} are correctly cleaned up");
+ }
+}
+
+
# [perl #79442] A #line "foo" directive in a string eval was not updating
# *{"_<foo"} in threaded perls, and was not putting the right lines into
# the right elements of @{"_<foo"} in non-threaded perls.