r62565 - in /branches/upstream/libtest-nowarnings-perl/current: ./ lib/Test/ lib/Test/NoWarnings/ t/

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Tue Sep 14 18:29:58 UTC 2010


Author: periapt-guest
Date: Tue Sep 14 18:29:27 2010
New Revision: 62565

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=62565
Log:
[svn-upgrade] new version libtest-nowarnings-perl (1.02)

Added:
    branches/upstream/libtest-nowarnings-perl/current/t/01_compile.t
    branches/upstream/libtest-nowarnings-perl/current/t/02_none.t
    branches/upstream/libtest-nowarnings-perl/current/t/03_end.t
    branches/upstream/libtest-nowarnings-perl/current/t/04_no_tests.t
    branches/upstream/libtest-nowarnings-perl/current/t/05_no_end.t
    branches/upstream/libtest-nowarnings-perl/current/t/06_fork.t
Removed:
    branches/upstream/libtest-nowarnings-perl/current/t/01_none.t
    branches/upstream/libtest-nowarnings-perl/current/t/02_end.t
    branches/upstream/libtest-nowarnings-perl/current/t/03_no_tests.t
    branches/upstream/libtest-nowarnings-perl/current/t/04_no_end.t
    branches/upstream/libtest-nowarnings-perl/current/t/05_fork.t
    branches/upstream/libtest-nowarnings-perl/current/t/97_meta.t
    branches/upstream/libtest-nowarnings-perl/current/t/98_pod.t
    branches/upstream/libtest-nowarnings-perl/current/t/99_pmv.t
Modified:
    branches/upstream/libtest-nowarnings-perl/current/Changes
    branches/upstream/libtest-nowarnings-perl/current/MANIFEST
    branches/upstream/libtest-nowarnings-perl/current/META.yml
    branches/upstream/libtest-nowarnings-perl/current/Makefile.PL
    branches/upstream/libtest-nowarnings-perl/current/README
    branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings.pm
    branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings/Warning.pm

Modified: branches/upstream/libtest-nowarnings-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/Changes?rev=62565&op=diff
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/Changes (original)
+++ branches/upstream/libtest-nowarnings-perl/current/Changes Tue Sep 14 18:29:27 2010
@@ -1,4 +1,15 @@
 Changes for Perl extension Test-NoWarnings
+
+1.02 Thu  9 Sep 2010 - Adam Kennedy
+	- Don't "use warnings" anywhere inside of Test::NoWarnings::* just
+	  in case we trigger a recursive warning handler in future (ADAMK)
+	- Remove the need for a private variable when detecting
+	  Devel::StackTrace support (ADAMK)
+	- Don't import unused functions from Carp or Test::Builder (ADAMK)
+	- Minor documentation tweaks (ADAMK)
+	- Correct the repository metadata in META.yml (ADAMK)
+	- Minor cleanups in the eumm-update generated code (ADAMK)
+	- Added a dedicated compile test (ADAMK)
 
 1.01 15 Jan 2010 - Adam Kennedy
 	- My release automation accidentally decided that Test::NoWarnings
@@ -10,6 +21,8 @@
 	  and the Makefile.PL contents, but otherwise remains unchanged (ADAMK)
 	- Now makes explicit the Perl 5.006 dependency that was previously
 	  an undocumented implicit dependency (ADAMK)
+	- Adding some rudimentary author tests, added automatically by
+	  my release automation (ADAMK)
 
 0.084 20 Oct 2007
 	- Perl 5.005 throws a warning when accessing $Carp::VERSION and was

Modified: branches/upstream/libtest-nowarnings-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/MANIFEST?rev=62565&op=diff
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/MANIFEST (original)
+++ branches/upstream/libtest-nowarnings-perl/current/MANIFEST Tue Sep 14 18:29:27 2010
@@ -5,12 +5,10 @@
 Makefile.PL
 MANIFEST			This list of files
 README
-t/01_none.t
-t/02_end.t
-t/03_no_tests.t
-t/04_no_end.t
-t/05_fork.t
-t/97_meta.t
-t/98_pod.t
-t/99_pmv.t
+t/01_compile.t
+t/02_none.t
+t/03_end.t
+t/04_no_tests.t
+t/05_no_end.t
+t/06_fork.t
 META.yml                                 Module meta-data (added by MakeMaker)

Modified: branches/upstream/libtest-nowarnings-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/META.yml?rev=62565&op=diff
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/META.yml (original)
+++ branches/upstream/libtest-nowarnings-perl/current/META.yml Tue Sep 14 18:29:27 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Test-NoWarnings
-version:            1.01
+version:            1.02
 abstract:           Make sure you didn't emit any warnings while testing
 author:
     - Fergal Daly <fergal at esatclear.ie>
@@ -9,19 +9,18 @@
 configure_requires:
     ExtUtils::MakeMaker:  0
 build_requires:
-    ExtUtils::MakeMaker:  0
-requires:
-    perl:           5.006
     Test::Builder:  0.86
     Test::More:     0.47
-    Test::Tester:   0.107
+requires:
+    perl:          5.006
+    Test::Tester:  0.107
 resources:
-    repository:  http://svn.ali.as/cpan/trunk/Config-Tiny
+    repository:  http://svn.ali.as/cpan/trunk/Test-NoWarnings
 no_index:
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.50
+generated_by:       ExtUtils::MakeMaker version 6.56
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: branches/upstream/libtest-nowarnings-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/Makefile.PL?rev=62565&op=diff
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/Makefile.PL (original)
+++ branches/upstream/libtest-nowarnings-perl/current/Makefile.PL Tue Sep 14 18:29:27 2010
@@ -1,45 +1,42 @@
+use 5.006;
 use strict;
-BEGIN {
-	require 5.006;
-}
-use ExtUtils::MakeMaker;
+use ExtUtils::MakeMaker ();
 
-WriteMakefile1(
+WriteMakefile(
 	NAME             => 'Test::NoWarnings',
 	ABSTRACT         => "Make sure you didn't emit any warnings while testing",
 	VERSION_FROM     => 'lib/Test/NoWarnings.pm',
 	AUTHOR           => 'Fergal Daly <fergal at esatclear.ie>',
-        LICENSE          => 'lgpl',
+	LICENSE          => 'lgpl',
 	MIN_PERL_VERSION => '5.006',
 	BUILD_REQUIRES   => {
 		'Test::More'    => '0.47',
 		'Test::Builder' => '0.86',
 	},
-	PREREQ_PM        => {
+	PREREQ_PM => {
 		'Test::Tester' => '0.107',
 	},
 	META_MERGE => {
 		resources => {
-			repository => 'http://svn.ali.as/cpan/trunk/Config-Tiny',
+			repository => 'http://svn.ali.as/cpan/trunk/Test-NoWarnings',
 		},
 	},
 );
 
 # Written by Alexandr Ciornii, version 0.20. Added by eumm-upgrade.
-sub WriteMakefile1 {
+# Modified by ADAMK to make it look a little cleaner.
+sub WriteMakefile {
 	my %params = @_;
-	my $eumm_version = $ExtUtils::MakeMaker::VERSION;
-	$eumm_version = eval $eumm_version;
-	die "License not specified" if not exists $params{LICENSE};
-	if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
+	my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
+	die "License not specified" unless exists $params{LICENSE};
+	if ( $params{BUILD_REQUIRES} and $eumm_version < 6.5503 ) {
 		#EUMM 6.5502 has problems with BUILD_REQUIRES
 		$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
 		delete $params{BUILD_REQUIRES};
 	}
 	delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
-	delete $params{META_MERGE} if $eumm_version < 6.46;
-	delete $params{LICENSE} if $eumm_version < 6.31;
-	delete $params{AUTHOR} if $] < 5.005;
+	delete $params{META_MERGE}       if $eumm_version < 6.46;
+	delete $params{LICENSE}          if $eumm_version < 6.31;
 
-	WriteMakefile(%params);
+	ExtUtils::MakeMaker::WriteMakefile(%params);
 }

Modified: branches/upstream/libtest-nowarnings-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/README?rev=62565&op=diff
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/README (original)
+++ branches/upstream/libtest-nowarnings-perl/current/README Tue Sep 14 18:29:27 2010
@@ -71,17 +71,17 @@
       module
 
 EXPORTABLE FUNCTIONS
-  had_no_warnings()
+  had_no_warnings
     This checks that there have been warnings emitted by your test scripts.
     Usually you will not call this explicitly as it is called automatically
     when your script finishes.
 
-  clear_warnings()
+  clear_warnings
     This will clear the array of warnings that have been captured. If the
     array is empty then a call to "had_no_warnings()" will produce a pass
     result.
 
-  warnings()
+  warnings
     This will return the array of warnings captured so far. Each element of
     this array is an object containing information about the warning. The
     following methods are available on these object.
@@ -113,9 +113,6 @@
     When counting your tests for the plan, don't forget to include the test
     that runs automatically when your script ends.
 
-BUGS
-    None that I know of.
-
 SUPPORT
     Bugs should be reported via the CPAN bug tracker at
 

Modified: branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings.pm?rev=62565&op=diff
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings.pm (original)
+++ branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings.pm Tue Sep 14 18:29:27 2010
@@ -3,14 +3,14 @@
 use 5.006;
 use strict;
 use warnings;
-use Carp;
-use Exporter ();
-use Test::Builder;
+use Carp                      ();
+use Exporter                  ();
+use Test::Builder             ();
 use Test::NoWarnings::Warning ();
 
 use vars qw( $VERSION @EXPORT_OK @ISA $do_end_test );
 BEGIN {
-	$VERSION   = '1.01';
+	$VERSION   = '1.02';
 	@ISA       = 'Exporter';
 	@EXPORT_OK = qw(
 		clear_warnings had_no_warnings warnings
@@ -206,18 +206,18 @@
 
 =head1 EXPORTABLE FUNCTIONS
 
-=head2 had_no_warnings()
+=head2 had_no_warnings
 
 This checks that there have been warnings emitted by your test scripts.
 Usually you will not call this explicitly as it is called automatically when
 your script finishes.
 
-=head2 clear_warnings()
+=head2 clear_warnings
 
 This will clear the array of warnings that have been captured. If the array
 is empty then a call to C<had_no_warnings()> will produce a pass result.
 
-=head2 warnings()
+=head2 warnings
 
 This will return the array of warnings captured so far. Each element of this
 array is an object containing information about the warning. The following
@@ -264,10 +264,6 @@
 When counting your tests for the plan, don't forget to include the test that
 runs automatically when your script ends.
 
-=head1 BUGS
-
-None that I know of.
-
 =head1 SUPPORT
 
 Bugs should be reported via the CPAN bug tracker at

Modified: branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings/Warning.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings/Warning.pm?rev=62565&op=diff
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings/Warning.pm (original)
+++ branches/upstream/libtest-nowarnings-perl/current/lib/Test/NoWarnings/Warning.pm Tue Sep 14 18:29:27 2010
@@ -2,15 +2,15 @@
 
 use 5.006;
 use strict;
-use warnings;
 use Carp ();
 
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.02';
+
+	# Optional stacktrace support
+	eval "require Devel::StackTrace";
 }
-
-my $STACKTRACE = eval "require Devel::StackTrace" || 0;
 
 sub new {
 	my $class = shift;
@@ -18,15 +18,14 @@
 }
 
 sub getTrace {
-	my $self = shift;
-	return $self->{Trace};
+	$_[0]->{Trace};
 }
 
 sub fillTrace {
 	my $self = shift;
 	$self->{Trace} = Devel::StackTrace->new(
 		ignore_class => [__PACKAGE__, @_],
-	) if $STACKTRACE;
+	) if $Devel::StackTrace::VERSION;
 }
 
 sub getCarp {

Added: branches/upstream/libtest-nowarnings-perl/current/t/01_compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/t/01_compile.t?rev=62565&op=file
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/t/01_compile.t (added)
+++ branches/upstream/libtest-nowarnings-perl/current/t/01_compile.t Tue Sep 14 18:29:27 2010
@@ -1,0 +1,18 @@
+#!/usr/bin/perl
+
+use strict;
+BEGIN {
+	$| = 1;
+	$^W = 1;
+}
+
+use Test::More tests => 4;
+
+require_ok( 'Test::NoWarnings' );
+ok( $Test::NoWarnings::VERSION, 'Loaded Test::NoWarnings' );
+ok( $Test::NoWarnings::Warning::VERSION, 'Loaded Test::NoWarnings::Warning' );
+is(
+	$Test::NoWarnings::VERSION,
+	$Test::NoWarnings::Warning::VERSION,
+	'Loaded matching Test::NoWarnings::Warning',
+);

Added: branches/upstream/libtest-nowarnings-perl/current/t/02_none.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/t/02_none.t?rev=62565&op=file
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/t/02_none.t (added)
+++ branches/upstream/libtest-nowarnings-perl/current/t/02_none.t Tue Sep 14 18:29:27 2010
@@ -1,0 +1,97 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Tester;
+use Test::More qw(no_plan);
+use Test::NoWarnings qw( had_no_warnings warnings clear_warnings );
+
+Test::NoWarnings::builder(Test::Tester::capture());
+
+sub a {
+	&b;
+}
+
+sub b {
+	warn shift;
+}
+
+SCOPE: {
+	check_test(
+		sub {
+			had_no_warnings("check warns");
+		},
+		{
+			actual_ok => 1,
+		},
+		"no warns"
+	);
+
+	my ($prem, $result) = check_test(
+		sub {
+			a("hello there");
+			had_no_warnings("check warns");
+		},
+		{
+			actual_ok => 0,
+		},
+		"1 warn"
+	);
+
+	like($result->{diag}, '/^There were 1 warning\\(s\\)/', "1 warn diag");
+	like($result->{diag}, "/Previous test 0 ''/", "1 warn diag test num");
+	like($result->{diag}, '/hello there/', "1 warn diag has warn");
+
+	my ($warn) = warnings();
+
+	# 5.8.5 changed Carp's behaviour when the string ends in a \n
+	# the monkey business is because 5.005 throws a "used only
+	# once" warning for $Carp::VERSION
+	my $cv   = do { no warnings; $Carp::VERSION };
+	my $base = $cv >= 1.03; 
+	my @carp = split("\n", $warn->getCarp);
+
+	like($carp[$base+1], '/main::b/', "carp level b");
+	like($carp[$base+2], '/main::a/', "carp level a");
+
+	SKIP: {
+		my $has_st = eval "require Devel::StackTrace" || 0;
+
+		skip("Devel::StackTrace not installed", 1) unless $has_st;
+		isa_ok($warn->getTrace, "Devel::StackTrace");
+	}
+}
+
+SCOPE: {
+	clear_warnings();
+	check_test(
+		sub {
+			had_no_warnings("check warns");
+		},
+		{
+			actual_ok => 1,
+		},
+		"clear warns"
+	);
+
+	my ($prem, $empty_result, $result) = check_tests(
+		sub {
+			had_no_warnings("check warns empty");
+			warn "hello once";
+			warn "hello twice";
+			had_no_warnings("check warns");
+		},
+		[
+			{
+				actual_ok => 1,
+			},
+			{
+				actual_ok => 0,
+			},
+		],
+		"2 warn"
+	);
+
+	like($result->{diag}, '/^There were 2 warning\\(s\\)/', "2 warn diag");
+	like($result->{diag}, "/Previous test 1 'check warns empty'/", "2 warn diag test num");
+	like($result->{diag}, '/hello once.*hello twice/s', "2 warn diag has warn");
+}

Added: branches/upstream/libtest-nowarnings-perl/current/t/03_end.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/t/03_end.t?rev=62565&op=file
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/t/03_end.t (added)
+++ branches/upstream/libtest-nowarnings-perl/current/t/03_end.t Tue Sep 14 18:29:27 2010
@@ -1,0 +1,40 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Tester;
+use Test::More tests => 6;
+
+my $cap = Test::Tester::capture();
+Test::NoWarnings::builder($cap);
+
+END {
+	my @tests = $cap->details;
+	cmp_results(
+		\@tests,
+		[
+			{
+				actual_ok => 1,
+				depth => undef,
+			},
+			{
+				actual_ok => 0,
+				depth => undef,
+			}
+		]
+	);
+
+	my $result = $tests[1];
+	like($result->{diag}, '/^There were 1 warning\\(s\\)/', "warn diag");
+	like($result->{diag}, "/Previous test 1 'fake test'/", "warn diag test num");
+	like($result->{diag}, '/my special warning /s', "warn diag has warn");
+}
+
+use Test::NoWarnings;
+
+SCOPE: {
+	# TB things never expect to be called directly by the test script
+	local($Test::Builder::Level) = $Test::Builder::Level - 1;
+
+	$cap->ok(1, "fake test");
+	warn "my special warning";
+}

Added: branches/upstream/libtest-nowarnings-perl/current/t/04_no_tests.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/t/04_no_tests.t?rev=62565&op=file
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/t/04_no_tests.t (added)
+++ branches/upstream/libtest-nowarnings-perl/current/t/04_no_tests.t Tue Sep 14 18:29:27 2010
@@ -1,0 +1,5 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 1;
+use Test::NoWarnings;

Added: branches/upstream/libtest-nowarnings-perl/current/t/05_no_end.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/t/05_no_end.t?rev=62565&op=file
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/t/05_no_end.t (added)
+++ branches/upstream/libtest-nowarnings-perl/current/t/05_no_end.t Tue Sep 14 18:29:27 2010
@@ -1,0 +1,6 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 2;
+use Test::NoWarnings;
+pass("just testing");

Added: branches/upstream/libtest-nowarnings-perl/current/t/06_fork.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-nowarnings-perl/current/t/06_fork.t?rev=62565&op=file
==============================================================================
--- branches/upstream/libtest-nowarnings-perl/current/t/06_fork.t (added)
+++ branches/upstream/libtest-nowarnings-perl/current/t/06_fork.t Tue Sep 14 18:29:27 2010
@@ -1,0 +1,11 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 2;
+use Test::NoWarnings;
+
+pass("just testing");
+
+# if it's working properly, only the parent will conduct a warnings test
+my $pid = fork;
+die "Forked failed, $!" unless defined $pid;




More information about the Pkg-perl-cvs-commits mailing list