summaryrefslogtreecommitdiff
path: root/t/900_leaktrace.t
diff options
context:
space:
mode:
Diffstat (limited to 't/900_leaktrace.t')
-rw-r--r--t/900_leaktrace.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/900_leaktrace.t b/t/900_leaktrace.t
new file mode 100644
index 0000000..233d085
--- /dev/null
+++ b/t/900_leaktrace.t
@@ -0,0 +1,31 @@
+#!perl -w
+
+use strict;
+use constant HAS_LEAKTRACE => eval{ require Test::LeakTrace };
+use Test::More HAS_LEAKTRACE ? (tests => 2) : (skip_all => 'require Test::LeakTrace');
+use Test::LeakTrace;
+
+use Compress::Bzip2;
+my $string = q/
+Twas brillig and the slithy toves
+did gire and gimble in the wabe
+All mimsey were the borogroves
+and the Momewrathes outgrabe
+ / x 20;
+
+leaks_cmp_ok{
+ my $compress = memBzip( $string );
+ my $uncompress = memBunzip( $compress );
+} '<', 1;
+
+do 't/lib.pl';
+
+leaks_cmp_ok{
+ my $INFILE = catfile( qw(bzlib-src sample0.bz2) );
+ local $/ = undef;
+ open( IN, "< $INFILE" ) or die "$INFILE: $!";
+ binmode IN;
+ my $sample0 = <IN>;
+ close( IN );
+ my $uncompress = memBunzip( $sample0 );
+} '<', 1;