[libclass-tiny-perl] 21/22: remove test prerequisites

gregor herrmann gregoa at debian.org
Sun May 31 14:03:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to annotated tag release-0.001
in repository libclass-tiny-perl.

commit 7d46fddf86b599a647087cd81b75cc9f0c1e739e
Author: David Golden <dagolden at cpan.org>
Date:   Fri Aug 16 10:26:39 2013 -0400

    remove test prerequisites
---
 META.json          |  7 ++++---
 dist.ini           |  4 ++++
 t/alfa.t           | 26 +++++++++++---------------
 t/baker.t          |  8 +++-----
 t/charlie.t        |  8 +++-----
 t/delta.t          |  8 +++-----
 t/echo.t           |  8 +++-----
 t/lib/TestUtils.pm | 28 ++++++++++++++++++++++++++++
 8 files changed, 59 insertions(+), 38 deletions(-)

diff --git a/META.json b/META.json
index ddb8879..8f6d48b 100644
--- a/META.json
+++ b/META.json
@@ -47,15 +47,16 @@
          }
       },
       "test" : {
+         "recommends" : {
+            "Test::FailWarnings" : "0"
+         },
          "requires" : {
+            "Exporter" : "0",
             "ExtUtils::MakeMaker" : "0",
             "File::Find" : "0",
             "File::Spec::Functions" : "0",
             "File::Temp" : "0",
             "List::Util" : "0",
-            "Test::Deep" : "0",
-            "Test::FailWarnings" : "0",
-            "Test::Fatal" : "0",
             "Test::More" : "0.96",
             "base" : "0",
             "lib" : "0",
diff --git a/dist.ini b/dist.ini
index 37a0ea6..55c8061 100644
--- a/dist.ini
+++ b/dist.ini
@@ -11,8 +11,12 @@ AutoMetaResources.bugtracker.github = user:dagolden
 stopwords = destructor
 
 [RemovePrereqs]
+remove = Test::FailWarnings
 remove = MRO::Compat
 remove = mro
 
+[Prereqs / TestRecommends ]
+Test::FailWarnings = 0
+
 [PerlVersionPrereqs / 5.010]
 MRO::Compat = 0
diff --git a/t/alfa.t b/t/alfa.t
index e46286e..727b2df 100644
--- a/t/alfa.t
+++ b/t/alfa.t
@@ -1,13 +1,11 @@
 use 5.008001;
 use strict;
 use warnings;
-use Test::More 0.96;
-use Test::FailWarnings;
-use Test::Deep '!blessed';
-use Test::Fatal;
-
 use lib 't/lib';
 
+use Test::More 0.96;
+use TestUtils;
+
 require_ok("Alfa");
 
 subtest "empty list constructor" => sub {
@@ -17,20 +15,20 @@ subtest "empty list constructor" => sub {
 };
 
 subtest "empty hash object constructor" => sub {
-    my $obj = new_ok("Alfa", [{}]);
+    my $obj = new_ok( "Alfa", [ {} ] );
     is( $obj->foo, undef, "foo is undef" );
     is( $obj->bar, undef, "bar is undef" );
 };
 
 subtest "one attribute set as list" => sub {
     my $obj = new_ok( "Alfa", [ foo => 23 ] );
-    is( $obj->foo, 23, "foo is set" );
+    is( $obj->foo, 23,    "foo is set" );
     is( $obj->bar, undef, "bar is undef" );
 };
 
 subtest "one attribute set as hash ref" => sub {
     my $obj = new_ok( "Alfa", [ { foo => 23 } ] );
-    is( $obj->foo, 23, "foo is set" );
+    is( $obj->foo, 23,    "foo is set" );
     is( $obj->bar, undef, "bar is undef" );
 };
 
@@ -48,16 +46,16 @@ subtest "both attributes set as hash ref" => sub {
 
 subtest "constructor makes shallow copy" => sub {
     my $fake = bless { foo => 23, bar => 42 }, "Fake";
-    my $obj = new_ok( "Alfa", [ $fake  ] );
+    my $obj = new_ok( "Alfa", [$fake] );
     is( ref $fake, "Fake", "object passed to constructor is original class" );
-    is( $obj->foo, 23, "foo is set" );
-    is( $obj->bar, 42, "bar is set" );
+    is( $obj->foo, 23,     "foo is set" );
+    is( $obj->bar, 42,     "bar is set" );
 };
 
 subtest "attributes are RW" => sub {
     my $obj = new_ok( "Alfa", [ { foo => 23, bar => 42 } ] );
     is( $obj->foo(24), 24, "changing foo returns new value" );
-    is( $obj->foo, 24, "accessing foo returns changed value" );
+    is( $obj->foo,     24, "accessing foo returns changed value" );
 };
 
 subtest "exceptions" => sub {
@@ -68,7 +66,7 @@ subtest "exceptions" => sub {
     );
 
     like(
-        exception { Alfa->new( qw/ foo bar baz/ ) },
+        exception { Alfa->new(qw/ foo bar baz/) },
         qr/Alfa->new\(\) got an odd number of elements/,
         "creating object with odd elements dies",
     );
@@ -79,8 +77,6 @@ subtest "exceptions" => sub {
         "creating object with array ref dies",
     );
 };
-    
-
 
 done_testing;
 # COPYRIGHT
diff --git a/t/baker.t b/t/baker.t
index 3860759..784e17b 100644
--- a/t/baker.t
+++ b/t/baker.t
@@ -1,13 +1,11 @@
 use 5.008001;
 use strict;
 use warnings;
-use Test::More 0.96;
-use Test::FailWarnings;
-use Test::Deep '!blessed';
-use Test::Fatal;
-
 use lib 't/lib';
 
+use Test::More 0.96;
+use TestUtils;
+
 require_ok("Baker");
 
 subtest "empty list constructor" => sub {
diff --git a/t/charlie.t b/t/charlie.t
index 7ba5754..1143ee0 100644
--- a/t/charlie.t
+++ b/t/charlie.t
@@ -1,13 +1,11 @@
 use 5.008001;
 use strict;
 use warnings;
-use Test::More 0.96;
-use Test::FailWarnings;
-use Test::Deep '!blessed';
-use Test::Fatal;
-
 use lib 't/lib';
 
+use Test::More 0.96;
+use TestUtils;
+
 require_ok("Charlie");
 
 subtest "all attributes set as list" => sub {
diff --git a/t/delta.t b/t/delta.t
index fc05cc9..d7e5a29 100644
--- a/t/delta.t
+++ b/t/delta.t
@@ -1,13 +1,11 @@
 use 5.008001;
 use strict;
 use warnings;
-use Test::More 0.96;
-use Test::FailWarnings;
-use Test::Deep '!blessed';
-use Test::Fatal;
-
 use lib 't/lib';
 
+use Test::More 0.96;
+use TestUtils;
+
 require_ok("Delta");
 
 subtest "attribute set as list" => sub {
diff --git a/t/echo.t b/t/echo.t
index f6a903e..41b708d 100644
--- a/t/echo.t
+++ b/t/echo.t
@@ -1,13 +1,11 @@
 use 5.008001;
 use strict;
 use warnings;
-use Test::More 0.96;
-use Test::FailWarnings;
-use Test::Deep '!blessed';
-use Test::Fatal;
-
 use lib 't/lib';
 
+use Test::More 0.96;
+use TestUtils;
+
 require_ok("Echo");
 
 subtest "attribute set as list" => sub {
diff --git a/t/lib/TestUtils.pm b/t/lib/TestUtils.pm
new file mode 100644
index 0000000..0ef7bf8
--- /dev/null
+++ b/t/lib/TestUtils.pm
@@ -0,0 +1,28 @@
+use 5.008001;
+use strict;
+use warnings;
+package TestUtils;
+
+use Carp;
+
+use Exporter;
+our @ISA = qw/Exporter/;
+our @EXPORT = qw(
+    exception
+);
+
+# If we have Test::FailWarnings, use it
+BEGIN {
+    eval { require Test::FailWarnings; 1 } and do { Test::FailWarnings->import };
+}
+
+sub exception(&) {
+    my $code = shift;
+    my $success = eval { $code->(); 1 };
+    my $err = $@;
+    return '' if $success;
+    croak "Execution died, but the error was lost" unless $@;
+    return $@;
+}
+
+1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libclass-tiny-perl.git



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