[libcode-tidyall-perl] 278/374: tweaks to strict construction

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 22:26:35 UTC 2013


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

js pushed a commit to branch master
in repository libcode-tidyall-perl.

commit 4c0a43180affffbb5e23f8a09ced07a047551248
Author: Jonathan Swartz <swartz at pobox.com>
Date:   Thu Sep 27 06:54:34 2012 -0700

    tweaks to strict construction
---
 lib/Code/TidyAll.pm         |    8 ++++++--
 lib/Code/TidyAll/t/Basic.pm |   12 +++++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/lib/Code/TidyAll.pm b/lib/Code/TidyAll.pm
index 862420f..ff09447 100644
--- a/lib/Code/TidyAll.pm
+++ b/lib/Code/TidyAll.pm
@@ -92,8 +92,12 @@ sub BUILD {
     # Strict constructor
     #
     if ( my @bad_params = grep { !$self->can($_) } keys(%$params) ) {
-        die sprintf( "unknown constructor param(s) %s",
-            join( ", ", sort map { "'$_'" } @bad_params ) );
+        die sprintf(
+            "unknown constructor param%s %s for %s",
+            @bad_params > 1 ? "s" : "",
+            join( ", ", sort map { "'$_'" } @bad_params ),
+            ref($self)
+        );
     }
 
     $self->{root_dir}         = realpath( $self->{root_dir} );
diff --git a/lib/Code/TidyAll/t/Basic.pm b/lib/Code/TidyAll/t/Basic.pm
index a07fb9c..2c630aa 100644
--- a/lib/Code/TidyAll/t/Basic.pm
+++ b/lib/Code/TidyAll/t/Basic.pm
@@ -239,7 +239,7 @@ sub test_errors : Tests {
             worse_param => 2
         );
     }
-    qr/unknown constructor param\(s\) 'bad_param', 'worse_param'/;
+    qr/unknown constructor params 'bad_param', 'worse_param'/;
 
     throws_ok {
         Code::TidyAll->new(
@@ -249,6 +249,16 @@ sub test_errors : Tests {
     }
     qr/could not load plugin class/;
 
+    throws_ok {
+        Code::TidyAll->new(
+            root_dir => $root_dir,
+            plugins  => {
+                test_plugin('UpperText') => { select => '**/*', bad_option => 1, worse_option => 2 }
+            }
+        )->plugin_objects;
+    }
+    qr/unknown options/;
+
     my $ct = Code::TidyAll->new( plugins => {%UpperText}, root_dir => $root_dir );
     my $output = capture_stdout { $ct->process_files("$root_dir/foo/bar.txt") };
     is( $output, "[tidied]  foo/bar.txt\n", "filename output" );

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



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