}
}
-use Test::More tests => 74;
+use Test::More tests => 76;
my $ro_err = qr/^Modification of a read-only value attempted/;
is( Internals::SvREFCNT(%foo), 1 );
is( Internals::SvREFCNT($foo{foo}), 1 );
+is( Internals::SvREFCNT($foo, 2), 2, "update ref count");
+is( Internals::SvREFCNT($foo), 2, "check we got the stored value");
+
+Internals::SvREFCNT($foo, 1 );
XSRETURN_IV(SvREFCNT(sv) - 1); /* Minus the ref created for us. */
else if (items == 2) {
/* I hope you really know what you are doing. */
- SvREFCNT(sv) = SvIV(ST(1));
- XSRETURN_IV(SvREFCNT(sv));
+ SvREFCNT(sv) = SvIV(ST(1)) + 1; /* we free one ref on exit */
+ XSRETURN_IV(SvREFCNT(sv) - 1);
}
XSRETURN_UNDEF; /* Can't happen. */
}