Pg version check for can_insert_returning
[dbsrgits/DBIx-Class-Historic.git] / t / 52cycle.t
CommitLineData
a917fb06 1use strict;
2use warnings;
3use Test::More;
4
5use lib qw(t/lib);
6
7BEGIN {
a109c954 8 require DBIx::Class;
9 plan skip_all => 'Test needs: ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_cycle')
10 unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_cycle') );
a917fb06 11}
12
13use DBICTest;
14use DBICTest::Schema;
551e711a 15use Scalar::Util ();
a917fb06 16
17import Test::Memory::Cycle;
18
551e711a 19my $weak;
a917fb06 20
551e711a 21{
22 my $s = $weak->{schema} = DBICTest->init_schema;
23 memory_cycle_ok($s, 'No cycles in schema');
24
25 my $rs = $weak->{resultset} = $s->resultset ('Artist');
26 memory_cycle_ok($rs, 'No cycles in resultset');
27
28 my $rsrc = $weak->{resultsource} = $rs->result_source;
29 memory_cycle_ok($rsrc, 'No cycles in resultsource');
30
31 my $row = $weak->{row} = $rs->first;
32 memory_cycle_ok($row, 'No cycles in row');
33
34 Scalar::Util::weaken ($_) for values %$weak;
35 memory_cycle_ok($weak, 'No cycles in weak object collection');
36}
37
38for (keys %$weak) {
39 ok (! $weak->{$_}, "No $_ leaks");
40}
41
42done_testing;