[libbread-board-perl] 10/66: clean up and adjust some of the errors
Jonas Smedegaard
js at alioth.debian.org
Sun Sep 29 21:23:31 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libbread-board-perl.
commit 8c05ed9dfd8e5596bf9a71086023a8d56334c283
Author: Jesse Luehrs <doy at tozt.net>
Date: Fri Jul 20 23:00:50 2012 -0500
clean up and adjust some of the errors
---
lib/Bread/Board.pm | 12 +++++++-----
t/027_sugar_w_include.t | 2 +-
t/301_sugar.t | 7 ++++---
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/lib/Bread/Board.pm b/lib/Bread/Board.pm
index 4162f4c..4ccc4e6 100644
--- a/lib/Bread/Board.pm
+++ b/lib/Bread/Board.pm
@@ -126,7 +126,8 @@ sub include ($) {
else {
confess "Couldn't compile $file: $@" if $@;
confess "Couldn't open $file for reading: $!" if $!;
- confess "$file compiles to false.";
+ confess "Unknown error when compiling $file "
+ . "(or $file doesn't return a true value)";
}
}
@@ -145,12 +146,13 @@ sub service ($@) {
}
else {
my $type = $params{service_type};
- $type = (exists $params{block} ? 'Block' : 'Constructor') unless $type;
+ $type = exists $params{block} ? 'Block' : 'Constructor'
+ unless defined $type;
$s = "Bread::Board::${type}Injection"->new(name => $name, %params);
}
}
else {
- confess "A service is defined by a name and either a single value or hash of\nparameters, you have supplied neither with:\n\t at _";
+ confess "A service is defined by a name and either a single value or hash of parameters; you have supplied neither";
}
return $s unless defined $CC;
$CC->add_service($s);
@@ -174,7 +176,7 @@ sub typemap ($@) {
my $type = shift;
(scalar @_ == 1)
- || confess "typemap has one argument at a time";
+ || confess "typemap takes a single argument";
my $service;
if (blessed $_[0]) {
@@ -185,7 +187,7 @@ sub typemap ($@) {
$service = $_[0]->infer_service( $type );
}
else {
- confess $_[0] . " doesn't do Bread::Board::Service and isn't a Bread::Board::Service::Inferred. No idea what to do with it.";
+ confess $_[0] . " isn't a service";
}
}
else {
diff --git a/t/027_sugar_w_include.t b/t/027_sugar_w_include.t
index 1ad3e29..ec3f48e 100644
--- a/t/027_sugar_w_include.t
+++ b/t/027_sugar_w_include.t
@@ -19,7 +19,7 @@ like(exception { include "$FindBin::Bin/lib/doesnt_exist.bb" },
"we get appropriate errors for files that don't exist");
like(exception { include "$FindBin::Bin/lib/false.bb" },
- qr/compiles to false/,
+ qr/false\.bb.*doesn't return a true value/,
"we get appropriate errors for files that evaluate to false");
{
diff --git a/t/301_sugar.t b/t/301_sugar.t
index 62ad651..5dab49d 100644
--- a/t/301_sugar.t
+++ b/t/301_sugar.t
@@ -49,13 +49,14 @@ like( $exception, qr/^The service class must do the Bread::Board::Service role/,
$exception = exception{ typemap ('Type') };
-like( $exception, qr/^typemap has one argu/, 'exception begins with: typemap has one argu' );
+like( $exception, qr/^typemap takes a single argument/,
+ "exception begins with: typemap takes a single argument" );
-$exception = exception{
+$exception = exception{
typemap ('Type', MyNonService->new)
};
-like( $exception, qr/doesn't do Bread::Board::Service/, 'exception contains: doesn\'t do Bread::Board::Service' );
+like( $exception, qr/isn't a service/, "exception contains: isn't a service" );
done_testing;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libbread-board-perl.git
More information about the Pkg-perl-cvs-commits
mailing list