| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use strictscip-perl cpan Devel-Refcount 0.10 strict/; |
| 4 | use warningsscip-perl cpan Devel-Refcount 0.10 warnings/; |
| 5 | |
| 6 | use Test::Morescip-perl cpan Devel-Refcount 0.10 Test/More/ tests => 3; |
| 7 | use Test::Fatalscip-perl cpan Devel-Refcount 0.10 Test/Fatal/; |
| 8 | |
| 9 | use Devel::Refcountscip-perl cpan Devel-Refcount 0.10 Devel/Refcount/ qw( assert_oneref ); |
| 10 | |
| 11 | my $anon = []; |
| 12 | |
| 13 | okscip-perl cpan Devel-Refcount 0.10 main/ok().( !exceptionscip-perl cpan Devel-Refcount 0.10 main/exception(). { assert_onerefscip-perl cpan Devel-Refcount 0.10 Devel/Refcount/assert_oneref(). $anon }, |
| 14 | 'assert_oneref on one-reference anon array' ); |
| 15 | |
| 16 | my $otherref = $anon; |
| 17 | |
| 18 | likescip-perl cpan Devel-Refcount 0.10 main/like().( exceptionscip-perl cpan Devel-Refcount 0.10 main/exception(). { assert_onerefscip-perl cpan Devel-Refcount 0.10 Devel/Refcount/assert_oneref(). $anon }, |
| 19 | qr/^Expected ARRAY\(0x[[:xdigit:]]+\) to have only one reference, found 2 at /, |
| 20 | 'assert_oneref on two-reference anon array' ); |
| 21 | |
| 22 | my %hash = ( element => [] ); |
| 23 | |
| 24 | okscip-perl cpan Devel-Refcount 0.10 main/ok().( !exceptionscip-perl cpan Devel-Refcount 0.10 main/exception(). { assert_onerefscip-perl cpan Devel-Refcount 0.10 Devel/Refcount/assert_oneref(). deletescip-perl cpan Devel-Refcount 0.10 main/delete(). $hash{element} }, |
| 25 | 'assert_oneref on deleted hash element' ); |