3 eval { require Devel::Leak };
4 ok($@, "", "loading module");
5 eval { import Devel::Leak };
6 ok($@, "", "running import");
8 eval { Devel::Leak::CheckSV($handle) };
9 ok($@ =~ /\QPlease call Devel::Check::NoteSV() before calling Devel::Check::CheckSV()/, 1, "no segfault");
12 my $count = Devel::Leak::NoteSV($handle);
13 print "$count SVs so far\n";
16 @somewhere = qw(one two);
18 my $now = Devel::Leak::CheckSV($handle);
19 ok($now, $count+2, "Number of SVs created unexpected");
21 eval { Devel::Leak::CheckSV($handle) };
22 ok($@ =~ /\QPlease call Devel::Check::NoteSV() before calling Devel::Check::CheckSV()/, 1, "cannot call CheckSV() twice");
25 my @somewhere_else = ();
27 my $count = Devel::Leak::NoteSV($handle2);
28 print "$count SVs so far\n";
31 @somewhere_else = qw(one two);
33 my $sv_list = Devel::Leak::ListSV($handle2);
34 ok($sv_list->[0], "one", "First leaked SV");
35 ok($sv_list->[1], "two", "Second leaked SV");
36 ok(@$sv_list, 2, "Count of leaked SVs");