Resolve $rsrc instance duality on metadata traversal
[dbsrgits/DBIx-Class.git] / t / 36double_destroy.t
CommitLineData
c40b5744 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3use strict;
4use warnings;
5
6use Test::More;
c40b5744 7
20c0d57b 8use DBICTest::Util 'capture_stderr';
c40b5744 9
10use DBICTest;
11
c40b5744 12my $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
37like(
38 $output,
39 qr/\QPreventing *MULTIPLE* DESTROY() invocations on DBIx::Class::Storage::TxnScopeGuard/,
40 'Proper warning emitted on STDERR'
41);
42
43done_testing;