Commit | Line | Data |
c40b5744 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
c40b5744 |
7 | |
20c0d57b |
8 | use DBICTest::Util 'capture_stderr'; |
c40b5744 |
9 | |
10 | use DBICTest; |
11 | |
c40b5744 |
12 | my $output; |
13 | |
14 | # ensure Devel::StackTrace-refcapture-like effects are countered |
15 | { |
16 | my $s = DBICTest::Schema->connect('dbi:SQLite::memory:'); |
17 | my $g = $s->txn_scope_guard; |
18 | |
19 | my @arg_capture; |
20 | { |
21 | local $SIG{__WARN__} = sub { |
22 | package DB; |
23 | my $frnum; |
24 | while (my @f = CORE::caller(++$frnum) ) { |
25 | push @arg_capture, @DB::args; |
26 | } |
27 | }; |
28 | |
29 | undef $g; |
30 | 1; |
31 | } |
32 | |
c40b5744 |
33 | # this should emit on stderr |
20c0d57b |
34 | $output = capture_stderr { @arg_capture = () }; |
35 | }; |
c40b5744 |
36 | |
37 | like( |
38 | $output, |
39 | qr/\QPreventing *MULTIPLE* DESTROY() invocations on DBIx::Class::Storage::TxnScopeGuard/, |
40 | 'Proper warning emitted on STDERR' |
41 | ); |
42 | |
43 | done_testing; |