/usr/share/doc/perl-Test-Simple/t/Test2/behavior
NameSizeModeActions
disable_ipc_a.t2030644editdlrm
disable_ipc_b.t2190644editdlrm
disable_ipc_c.t2560644editdlrm
disable_ipc_d.t4580644editdlrm
err_var.t1770644editdlrm
Formatter.t16770644editdlrm
init_croak.t5890644editdlrm
intercept.t11170644editdlrm
ipc_wait_timeout.t23510644editdlrm
nested_context_exception.t21390644editdlrm
no_load_api.t15610644editdlrm
run_subtest_inherit.t22640644editdlrm
special_names.t13140644editdlrm
subtest_bailout.t11820644editdlrm
Subtest_buffer_formatter.t26800644editdlrm
Subtest_callback.t9060644editdlrm
Subtest_events.t4410644editdlrm
Subtest_plan.t3550644editdlrm
Subtest_todo.t9320644editdlrm
Taint.t3560644editdlrm
trace_signature.t15070644editdlrm
uuid.t34140644editdlrm
Edit: /usr/share/doc/perl-Test-Simple/t/Test2/behavior/nested_context_exception.t (2139B)
use strict; use warnings; BEGIN { $Test2::API::DO_DEPTH_CHECK = 1 } use Test2::Tools::Tiny; use Test2::API qw/context/; skip_all("known to fail on $]") if $] le "5.006002"; sub outer { my $code = shift; my $ctx = context(); $ctx->note("outer"); my $out = eval { $code->() }; $ctx->release; return $out; } sub dies { my $ctx = context(); $ctx->note("dies"); die "Foo"; } sub bad_store { my $ctx = context(); $ctx->note("bad store"); return $ctx; # Emulate storing it somewhere } sub bad_simple { my $ctx = context(); $ctx->note("bad simple"); return; } my @warnings; { local $SIG{__WARN__} = sub { push @warnings => @_ }; eval { dies() }; } ok(!@warnings, "no warnings") || diag @warnings; @warnings = (); my $keep = bad_store(); eval { my $x = 1 }; # Ensure an eval changing $@ does not meddle. { local $SIG{__WARN__} = sub { push @warnings => @_ }; ok(1, "random event"); } ok(@warnings, "got warnings"); like( $warnings[0], qr/context\(\) was called to retrieve an existing context/, "got expected warning" ); $keep = undef; { @warnings = (); local $SIG{__WARN__} = sub { push @warnings => @_ }; bad_simple(); } ok(@warnings, "got warnings"); like( $warnings[0], qr/A context appears to have been destroyed without first calling release/, "got expected warning" ); @warnings = (); outer(\&dies); { local $SIG{__WARN__} = sub { push @warnings => @_ }; ok(1, "random event"); } ok(!@warnings, "no warnings") || diag @warnings; @warnings = (); { local $SIG{__WARN__} = sub { push @warnings => @_ }; outer(\&bad_store); } ok(@warnings, "got warnings"); like( $warnings[0], qr/A context appears to have been destroyed without first calling release/, "got expected warning" ); { @warnings = (); local $SIG{__WARN__} = sub { push @warnings => @_ }; outer(\&bad_simple); } ok(@warnings, "got warnings") || diag @warnings; like( $warnings[0], qr/A context appears to have been destroyed without first calling release/, "got expected warning" ); done_testing;