On Tue Jun 25 16:44:02 2019, SREZIC wrote:
Show quoted text> This seems to happen if Devel::FindRef and Devel::MAT are installed.
Oops, yes I forgot to test it in that scenario.
Patch attached.
--
Paul Evans
=== modified file 't/01count.t'
--- t/01count.t 2019-06-24 16:20:36 +0000
+++ t/01count.t 2019-06-26 10:25:22 +0000
@@ -8,8 +8,6 @@
use Test::Refcount;
-use constant HAVE_DEVEL_FINDREF => eval { require Devel::FindRef };
-
my $anon = [];
test_out( "ok 1 - anon ARRAY ref" );
@@ -37,14 +35,14 @@
test_out( "not ok 1 - one ref" );
test_fail( +10 );
test_err( "# expected 1 references, found 2" );
-test_err( qr/^# Some::Class=HASH\(0x[0-9a-f]+\) (?:\[refcount 2\] )?is\n/ ) if HAVE_DEVEL_FINDREF;
-if( HAVE_DEVEL_FINDREF ) {
- test_err( qr/(?:^#.*\n){1,}/m ); # Don't be sensitive on what Devel::FindRef actually prints
-}
-elsif( Test::Refcount::HAVE_DEVEL_MAT_DUMPER ) {
+if( Test::Refcount::HAVE_DEVEL_MAT_DUMPER ) {
test_err( qr/^# SV address is 0x[0-9a-f]+\n/ );
test_err( qr/^# Writing heap dump to \S+\n/ );
}
+if( Test::Refcount::HAVE_DEVEL_FINDREF ) {
+ test_err( qr/^# Some::Class=HASH\(0x[0-9a-f]+\) (?:\[refcount 2\] )?is\n/ );
+ test_err( qr/(?:^#.*\n){1,}/m ); # Don't be sensitive on what Devel::FindRef actually prints
+}
is_refcount( $object, 1, 'one ref' );
test_test( "two refs to object fails to be 1" );
=== modified file 't/02one.t'
--- t/02one.t 2019-06-24 16:20:36 +0000
+++ t/02one.t 2019-06-26 10:25:22 +0000
@@ -8,8 +8,6 @@
use Test::Refcount;
-use constant HAVE_DEVEL_FINDREF => eval { require Devel::FindRef };
-
my $anon = [];
test_out( "ok 1 - anon ARRAY ref" );
@@ -27,14 +25,14 @@
test_out( "not ok 1 - one ref" );
test_fail( +10 );
test_err( "# expected 1 references, found 2" );
-if( HAVE_DEVEL_FINDREF ) {
+if( Test::Refcount::HAVE_DEVEL_MAT_DUMPER ) {
+ test_err( qr/^# SV address is 0x[0-9a-f]+\n/ );
+ test_err( qr/^# Writing heap dump to \S+\n/ );
+}
+if( Test::Refcount::HAVE_DEVEL_FINDREF ) {
test_err( qr/^# Some::Class=HASH\(0x[0-9a-f]+\) (?:\[refcount 2\] )?is\n/ );
test_err( qr/(?:^#.*\n){1,}/m ); # Don't be sensitive on what Devel::FindRef actually prints
}
-elsif( Test::Refcount::HAVE_DEVEL_MAT_DUMPER ) {
- test_err( qr/^# SV address is 0x[0-9a-f]+\n/ );
- test_err( qr/^# Writing heap dump to \S+\n/ );
-}
is_oneref( $object, 'one ref' );
test_test( "two refs to object fails to be 1" );
=== modified file 't/03weak.t'
--- t/03weak.t 2019-06-24 16:20:36 +0000
+++ t/03weak.t 2019-06-26 10:25:22 +0000
@@ -10,8 +10,6 @@
use Test::Refcount;
-use constant HAVE_DEVEL_FINDREF => eval { require Devel::FindRef };
-
my $object = bless {}, "Some::Class";
my $newref = $object;
@@ -19,14 +17,14 @@
test_out( "not ok 1 - one ref" );
test_fail( +10 );
test_err( "# expected 1 references, found 2" );
-if( HAVE_DEVEL_FINDREF ) {
+if( Test::Refcount::HAVE_DEVEL_MAT_DUMPER ) {
+ test_err( qr/^# SV address is 0x[0-9a-f]+\n/ );
+ test_err( qr/^# Writing heap dump to \S+\n/ );
+}
+if( Test::Refcount::HAVE_DEVEL_FINDREF ) {
test_err( qr/^# Some::Class=HASH\(0x[0-9a-f]+\) (?:\[refcount 2\] )?is\n/ );
test_err( qr/(?:^#.*\n){1,}/m ); # Don't be sensitive on what Devel::FindRef actually prints
}
-elsif( Test::Refcount::HAVE_DEVEL_MAT_DUMPER ) {
- test_err( qr/^# SV address is 0x[0-9a-f]+\n/ );
- test_err( qr/^# Writing heap dump to \S+\n/ );
-}
is_oneref( $object, 'one ref' );
test_test( "two refs to object fails to be 1" );