From 311e480283c8eb693419e7abada749fb80e10dda Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 8 Aug 2010 13:31:53 +0200 Subject: Split up Error.pm into WWW::Efa::Error::{Backend,Setup} --- t/50-www-efa.t | 27 ++++++++++++++------------- t/60-bin-efa.t | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 't') diff --git a/t/50-www-efa.t b/t/50-www-efa.t index 8a54025..e527272 100644 --- a/t/50-www-efa.t +++ b/t/50-www-efa.t @@ -3,7 +3,7 @@ use strict; use warnings; use 5.010; -use Test::More tests => 127; +use Test::More tests => 135; BEGIN { use_ok('WWW::Efa'); @@ -77,28 +77,29 @@ sub is_efa_err { "conf ok: $key => $val", ); + isa_ok($efa->{'error'}, 'WWW::Efa::Error::Setup'); + is( - $efa->{'error'}->{'source'}, 'internal', - "$key => $val: Error source is internal", + $efa->{'error'}->{'key'}, $key, + "$key => $val: Error: Correct key", ); is( - $efa->{'error'}->{'type'}, 'conf', - "$key => $val: Error type is conf", + $efa->{'error'}->{'value'}, $val_want, + "$key => $val: Error: Correct valuef", ); - - is_deeply( - $efa->{'error'}->{'data'}, [$key, $val_want, $str], - "$key => $val: Error data is [$key, $val_want, $str]", + is( + $efa->{'error'}->{'message'}, $str, + "$key => $val: Error: String is '$str'", ); } is_efa_post('ignored', 'ignored'); my $efa = new_ok('WWW::Efa' => []); -isa_ok($efa->{'error'}, 'WWW::Efa::Error'); -is($efa->{'error'}->{'source'}, 'internal'); -is($efa->{'error'}->{'type'}, 'conf' ); -is_deeply($efa->{'error'}->{'data'}, ['place', 'origin', 'Need at least two elements']); +isa_ok($efa->{'error'}, 'WWW::Efa::Error::Setup'); +is($efa->{'error'}->{'key'}, 'place'); +is($efa->{'error'}->{'value'}, 'origin'); +is($efa->{'error'}->{'message'}, 'Need at least two elements'); is_efa_post( 'via', ['MH', 'HBf'], diff --git a/t/60-bin-efa.t b/t/60-bin-efa.t index 6bb9f5d..8337b62 100644 --- a/t/60-bin-efa.t +++ b/t/60-bin-efa.t @@ -16,7 +16,7 @@ my $re_version = qr{\S*efa version \S+}; sub mk_err { my ($arg, $value, $message) = @_; return sprintf( - "WWW::Efa config error: Wrong arg for option %s: %s\n%s\n", + "WWW::Efa setup error: Wrong arg for option %s: %s\n%s\n", $arg, $value, $message ); } -- cgit v1.2.3