r47770 - in /branches/upstream/libtest-refcount-perl/current: Build.PL Changes META.yml Makefile.PL README lib/Test/Refcount.pm t/01count.t t/02one.t t/03weak.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Thu Nov 26 03:49:26 UTC 2009
Author: jawnsy-guest
Date: Thu Nov 26 03:49:21 2009
New Revision: 47770
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47770
Log:
[svn-upgrade] Integrating new upstream version, libtest-refcount-perl (0.06)
Modified:
branches/upstream/libtest-refcount-perl/current/Build.PL
branches/upstream/libtest-refcount-perl/current/Changes
branches/upstream/libtest-refcount-perl/current/META.yml
branches/upstream/libtest-refcount-perl/current/Makefile.PL
branches/upstream/libtest-refcount-perl/current/README
branches/upstream/libtest-refcount-perl/current/lib/Test/Refcount.pm
branches/upstream/libtest-refcount-perl/current/t/01count.t
branches/upstream/libtest-refcount-perl/current/t/02one.t
branches/upstream/libtest-refcount-perl/current/t/03weak.t
Modified: branches/upstream/libtest-refcount-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/Build.PL?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/Build.PL (original)
+++ branches/upstream/libtest-refcount-perl/current/Build.PL Thu Nov 26 03:49:21 2009
@@ -7,15 +7,14 @@
(
module_name => 'Test::Refcount',
requires => {
- 'Devel::FindRef' => 0,
- 'Devel::Refcount' => 0,
- 'Scalar::Util' => 0,
- 'Test::Builder' => 0,
+ 'Devel::Refcount' => 0,
+ 'Scalar::Util' => 0,
+ 'Test::Builder' => 0,
},
build_requires => {
- 'Test::Builder::Tester' => 0,
- 'Test::More' => 0,
- },
+ 'Test::Builder::Tester' => 0,
+ 'Test::More' => 0,
+ },
license => 'perl',
create_makefile_pl => 'traditional',
create_license => 1,
Modified: branches/upstream/libtest-refcount-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/Changes?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/Changes (original)
+++ branches/upstream/libtest-refcount-perl/current/Changes Thu Nov 26 03:49:21 2009
@@ -1,4 +1,9 @@
Revision history for Test-Refcount
+
+0.06 CHANGES:
+ * Optionally use Devel::FindRef but don't depend on it being
+ installed. Removes the need to install it on smoke testers and have
+ it fail.
0.05 CHANGES:
* Added 'use warnings'
Modified: branches/upstream/libtest-refcount-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/META.yml?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/META.yml (original)
+++ branches/upstream/libtest-refcount-perl/current/META.yml Thu Nov 26 03:49:21 2009
@@ -1,25 +1,26 @@
---
name: Test-Refcount
-version: 0.05
+version: 0.06
author:
- 'Paul Evans <leonerd at leonerd.org.uk>'
abstract: assert reference counts on objects
license: perl
resources:
license: http://dev.perl.org/licenses/
+build_requires:
+ Test::Builder::Tester: 0
+ Test::More: 0
requires:
- Devel::FindRef: 0
Devel::Refcount: 0
Scalar::Util: 0
Test::Builder: 0
-build_requires:
- Test::Builder::Tester: 0
- Test::More: 0
+configure_requires:
+ Module::Build: 0.35
provides:
Test::Refcount:
file: lib/Test/Refcount.pm
- version: 0.05
-generated_by: Module::Build version 0.33
+ version: 0.06
+generated_by: Module::Build version 0.35
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: branches/upstream/libtest-refcount-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/Makefile.PL?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/Makefile.PL (original)
+++ branches/upstream/libtest-refcount-perl/current/Makefile.PL Thu Nov 26 03:49:21 2009
@@ -1,11 +1,10 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.33
+# Note: this file was auto-generated by Module::Build::Compat version 0.35
use ExtUtils::MakeMaker;
WriteMakefile
(
'NAME' => 'Test::Refcount',
'VERSION_FROM' => 'lib/Test/Refcount.pm',
'PREREQ_PM' => {
- 'Devel::FindRef' => 0,
'Devel::Refcount' => 0,
'Scalar::Util' => 0,
'Test::Builder' => 0,
Modified: branches/upstream/libtest-refcount-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/README?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/README (original)
+++ branches/upstream/libtest-refcount-perl/current/README Thu Nov 26 03:49:21 2009
@@ -28,9 +28,10 @@
holds for an object class, so as to be polite to its callers.
If the assertion fails; that is, if the actual reference count is
- different to what was expected, a trace of references to the object is
- printed, using Marc Lehmann's Devel::FindRef module. See the examples
- below for more information.
+ different to what was expected, a trace of references to the object can
+ be printed, if Marc Lehmann's Devel::FindRef module is installed. This
+ may assist the developer in finding where the references are. See the
+ examples below for more information.
FUNCTIONS
is_refcount( $object, $count, $name )
@@ -46,17 +47,17 @@
use Test::More tests => 2;
use Test::Refcount;
-
- use MyBall;
-
- my $ball = MyBall->new();
+
+ use MyBall;
+
+ my $ball = MyBall->new();
is_oneref( $ball, 'One reference after construct' );
-
- $ball->bounce;
+
+ $ball->bounce;
# Any other code here that might be part of the test script
-
- is_oneref( $ball, 'One reference just before EOF' );
+
+ is_oneref( $ball, 'One reference just before EOF' );
The first assertion is just after the constructor, to check that the
reference returned by it is the only reference to that object. This fact
@@ -65,7 +66,8 @@
At this stage we expect the reference count also to be one, so that the
object is properly cleaned up.
- Suppose, when run, this produces the following output:
+ Suppose, when run, this produces the following output (presuming
+ "Devel::FindRef" is available):
1..2
ok 1 - One reference after construct
@@ -111,6 +113,18 @@
program probably wouldn't do anything quite this obvious, the trace
would still be useful in finding the likely cause of the leak.
+ If "Devel::FindRef" is unavailable, then these detailed traces will not
+ be produced. The basic reference count testing will still take place,
+ but a smaller message will be produced:
+
+ 1..2
+ ok 1 - One reference after construct
+ not ok 2 - One reference just before EOF
+ # Failed test 'One reference just before EOF'
+ # at demo.pl line 16.
+ # expected 1 references, found 2
+ # Looks like you failed 1 test of 2.
+
BUGS
* Temporaries created on the stack
Modified: branches/upstream/libtest-refcount-perl/current/lib/Test/Refcount.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/lib/Test/Refcount.pm?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/lib/Test/Refcount.pm (original)
+++ branches/upstream/libtest-refcount-perl/current/lib/Test/Refcount.pm Thu Nov 26 03:49:21 2009
@@ -1,7 +1,7 @@
# You may distribute under the terms of either the GNU General Public License
# or the Artistic License (the same terms as Perl itself)
#
-# (C) Paul Evans, 2008 -- leonerd at leonerd.org.uk
+# (C) Paul Evans, 2008,2009 -- leonerd at leonerd.org.uk
package Test::Refcount;
@@ -12,9 +12,8 @@
use Scalar::Util qw( weaken );
use Devel::Refcount qw( refcount );
-use Devel::FindRef;
-
-our $VERSION = '0.05';
+
+our $VERSION = '0.06';
our @EXPORT = qw(
is_refcount
@@ -53,8 +52,9 @@
for an object class, so as to be polite to its callers.
If the assertion fails; that is, if the actual reference count is different to
-what was expected, a trace of references to the object is printed, using
-Marc Lehmann's L<Devel::FindRef> module. See the examples below for more
+what was expected, a trace of references to the object can be printed, if
+Marc Lehmann's L<Devel::FindRef> module is installed. This may assist the
+developer in finding where the references are. See the examples below for more
information.
=cut
@@ -90,7 +90,10 @@
unless( $ok ) {
$tb->diag( " expected $count references, found $REFCNT" );
- $tb->diag( Devel::FindRef::track( $object ) );
+
+ if( eval { require Devel::FindRef } ) {
+ $tb->diag( Devel::FindRef::track( $object ) );
+ }
}
return $ok;
@@ -139,7 +142,8 @@
end of the file, just before the main scope closes. At this stage we expect
the reference count also to be one, so that the object is properly cleaned up.
-Suppose, when run, this produces the following output:
+Suppose, when run, this produces the following output (presuming
+C<Devel::FindRef> is available):
1..2
ok 1 - One reference after construct
@@ -184,6 +188,18 @@
probably wouldn't do anything quite this obvious, the trace would still be
useful in finding the likely cause of the leak.
+If C<Devel::FindRef> is unavailable, then these detailed traces will not be
+produced. The basic reference count testing will still take place, but a
+smaller message will be produced:
+
+ 1..2
+ ok 1 - One reference after construct
+ not ok 2 - One reference just before EOF
+ # Failed test 'One reference just before EOF'
+ # at demo.pl line 16.
+ # expected 1 references, found 2
+ # Looks like you failed 1 test of 2.
+
=head1 BUGS
=over 4
Modified: branches/upstream/libtest-refcount-perl/current/t/01count.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/t/01count.t?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/t/01count.t (original)
+++ branches/upstream/libtest-refcount-perl/current/t/01count.t Thu Nov 26 03:49:21 2009
@@ -5,6 +5,8 @@
use Test::Builder::Tester tests => 8;
use Test::Refcount;
+
+use constant HAVE_DEVEL_FINDREF => eval { require Devel::FindRef };
my $anon = [];
@@ -33,8 +35,8 @@
test_out( "not ok 1 - one ref" );
test_fail( +4 );
test_err( "# expected 1 references, found 2" );
-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
+test_err( qr/^# Some::Class=HASH\(0x[0-9a-f]+\) (?:\[refcount 2\] )?is\n/ ) if HAVE_DEVEL_FINDREF;
+test_err( qr/(?:^#.*\n){1,}/m ) if HAVE_DEVEL_FINDREF; # 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: branches/upstream/libtest-refcount-perl/current/t/02one.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/t/02one.t?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/t/02one.t (original)
+++ branches/upstream/libtest-refcount-perl/current/t/02one.t Thu Nov 26 03:49:21 2009
@@ -5,6 +5,8 @@
use Test::Builder::Tester tests => 3;
use Test::Refcount;
+
+use constant HAVE_DEVEL_FINDREF => eval { require Devel::FindRef };
my $anon = [];
@@ -23,7 +25,7 @@
test_out( "not ok 1 - one ref" );
test_fail( +4 );
test_err( "# expected 1 references, found 2" );
-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
+test_err( qr/^# Some::Class=HASH\(0x[0-9a-f]+\) (?:\[refcount 2\] )?is\n/ ) if HAVE_DEVEL_FINDREF;
+test_err( qr/(?:^#.*\n){1,}/m ) if HAVE_DEVEL_FINDREF; # Don't be sensitive on what Devel::FindRef actually prints
is_oneref( $object, 'one ref' );
test_test( "two refs to object fails to be 1" );
Modified: branches/upstream/libtest-refcount-perl/current/t/03weak.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-refcount-perl/current/t/03weak.t?rev=47770&op=diff
==============================================================================
--- branches/upstream/libtest-refcount-perl/current/t/03weak.t (original)
+++ branches/upstream/libtest-refcount-perl/current/t/03weak.t Thu Nov 26 03:49:21 2009
@@ -8,6 +8,8 @@
use Test::Refcount;
+use constant HAVE_DEVEL_FINDREF => eval { require Devel::FindRef };
+
my $object = bless {}, "Some::Class";
my $newref = $object;
@@ -15,8 +17,8 @@
test_out( "not ok 1 - one ref" );
test_fail( +4 );
test_err( "# expected 1 references, found 2" );
-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
+test_err( qr/^# Some::Class=HASH\(0x[0-9a-f]+\) (?:\[refcount 2\] )?is\n/ ) if HAVE_DEVEL_FINDREF;
+test_err( qr/(?:^#.*\n){1,}/m ) if HAVE_DEVEL_FINDREF; # Don't be sensitive on what Devel::FindRef actually prints
is_oneref( $object, 'one ref' );
test_test( "two refs to object fails to be 1" );
More information about the Pkg-perl-cvs-commits
mailing list