weak ref support
[p5sagit/Data-Dumper-ToXS.git] / t / basic.t
index 0e46ba9..9c6fe07 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -2,6 +2,8 @@ use strictures 1;
 use Test::More;
 use Data::Dumper::ToXS::Test;
 use Data::Dumper;
+use Devel::Peek qw(SvREFCNT);
+use Scalar::Util qw(isweak);
 
 my @fix = do 't/fixtures.pl' or die "t/fixtures.pl: $@";
 
@@ -16,4 +18,10 @@ foreach my $f (@fix) {
   is($l, $d, "Round tripped ${\$f->[0]} ok");
 }
 
+{
+  my $r = $result{weaken_1};
+  ok(isweak($r->[1]), 'Weak element is weak');
+  is(SvREFCNT(${$r->[1]}), 2, 'Refcount of target correct');
+}
+
 done_testing;