File: 01_info.t

package info (click to toggle)
libtest-leaktrace-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 412 kB
  • ctags: 879
  • sloc: ansic: 3,215; perl: 1,789; makefile: 7
file content (46 lines) | stat: -rw-r--r-- 934 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!perl -w

use strict;
use Test::More tests => 4;

use Test::LeakTrace;
use autouse 'Data::Dumper' => 'Dumper';

my @info = leaked_info{
	my %a = (foo => 42);
	my %b = (bar => 3.14);

	$b{a} = \%a;
	$a{b} = \%b;

	pass 'in leaktrace block';
};

cmp_ok(scalar(@info), '>', 1)
	or diag(Dumper(\@info));

my($si) = grep {
		my $ref = $_->[0];
		ref($ref) eq 'REF' and ref(${$ref}) eq 'HASH' and exists ${$ref}->{a}
	} @info;


like __FILE__, qr/$si->[1]/, 'state info'
	or diag(Dumper \@info);

@info = leaked_info{
#line 1 here_is_extreamely_long_file_name_that_tests_the_file_name_limitation_in_stateinfo_in_LeakTrace_xs
	my %a = (foo => 42);
	my %b = (bar => 3.14);

	$b{a} = \%a;
	$a{b} = \%b;
};


($si) = grep {
		my $ref = $_->[0];
		ref($ref) eq 'REF' and ref(${$ref}) eq 'HASH' and exists ${$ref}->{a}
	} @info;

is 'here_is_extreamely_long_file_name_that_tests_the_file_name_limitation_in_stateinfo_in_LeakTrace_xs', $si->[1];