mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-18 20:38:00 +01:00
Add leaktrace tests
This commit is contained in:
parent
f8ee79ab72
commit
fe7e7a8d07
40
perl/xt/leaks/leaktrace.t
Executable file
40
perl/xt/leaks/leaktrace.t
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!perl -w
|
||||||
|
use strict;
|
||||||
|
use Test::Requires 'Test::LeakTrace';
|
||||||
|
use Test::More;
|
||||||
|
|
||||||
|
use Data::MessagePack;
|
||||||
|
|
||||||
|
my $data = {
|
||||||
|
a => 'foo',
|
||||||
|
b => 42,
|
||||||
|
c => undef,
|
||||||
|
d => [qw(bar baz)],
|
||||||
|
e => 3.14,
|
||||||
|
};
|
||||||
|
|
||||||
|
no_leaks_ok {
|
||||||
|
my $s = Data::MessagePack->pack($data);
|
||||||
|
};
|
||||||
|
|
||||||
|
no_leaks_ok {
|
||||||
|
eval { Data::MessagePack->pack([\*STDIN]) };
|
||||||
|
#note $@;
|
||||||
|
$@ or die "it must die";
|
||||||
|
};
|
||||||
|
|
||||||
|
my $s = Data::MessagePack->pack($data);
|
||||||
|
|
||||||
|
no_leaks_ok {
|
||||||
|
my $data = Data::MessagePack->unpack($s);
|
||||||
|
};
|
||||||
|
|
||||||
|
no_leaks_ok {
|
||||||
|
my $ss = $s;
|
||||||
|
chop $ss;
|
||||||
|
eval { Data::MessagePack->unpack($ss) };
|
||||||
|
#note $@;
|
||||||
|
$@ or die "it must die";
|
||||||
|
};
|
||||||
|
|
||||||
|
done_testing;
|
Loading…
x
Reference in New Issue
Block a user