Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lastmail now configurable, plus lots of tests
- Loading branch information
barbie
committed
Jan 19, 2009
1 parent
88fc2b2
commit 1115416
Showing
14 changed files
with
483 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More tests => 25; | ||
use CPAN::Testers::WWW::Reports::Mailer; | ||
|
||
use lib 't'; | ||
use CTWRM_Testing; | ||
|
||
ok( my $obj = CTWRM_Testing::getObj(), "got object" ); | ||
|
||
# test the attributes generated by Class::Accessor::Chained::Fast | ||
|
||
# predefined attributes | ||
foreach my $k ( qw/ | ||
debug | ||
logfile | ||
logclean | ||
tt | ||
pause | ||
lastmail | ||
/ ){ | ||
my $label = "[$k]"; | ||
SKIP: { | ||
ok( $obj->can($k), "$label can" ) | ||
or skip "'$k' attribute missing", 3; | ||
isnt( $obj->$k(), undef, "$label has default" ); | ||
is( $obj->$k(123), $obj, "$label set" ); # chained, so returns object, not value. | ||
is( $obj->$k, 123, "$label get" ); | ||
}; | ||
} | ||
|
||
# undefined attributes | ||
#foreach my $k ( qw/ | ||
# authors | ||
# perls | ||
# logfile | ||
# mode | ||
#/ ){ | ||
# my $label = "[$k]"; | ||
# SKIP: { | ||
# ok( $obj->can($k), "$label can" ) | ||
# or skip "'$k' attribute missing", 3; | ||
# is( $obj->$k(), undef, "$label has no default" ); | ||
# is( $obj->$k(123), $obj, "$label set" ); # chained, so returns object, not value. | ||
# is( $obj->$k, 123, "$label get" ); | ||
# }; | ||
#} | ||
|
||
# TODO -- test these: | ||
# $MAX_ID; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More tests => 2; | ||
use CPAN::Testers::WWW::Reports::Mailer; | ||
|
||
use lib 't'; | ||
use CTWRM_Testing; | ||
|
||
{ | ||
ok( my $obj = CTWRM_Testing::getObj(), "got object" ); | ||
|
||
$obj->check_counts; | ||
|
||
my ($counts,@log); | ||
open FILE, '<', $obj->logfile; | ||
while(<FILE>) { | ||
next unless($counts || /COUNTS:/); | ||
$counts = 1; | ||
chomp; | ||
push @log, substr($_,21); | ||
} | ||
|
||
is_deeply(\@log, [ | ||
'INFO: COUNTS:', | ||
'INFO: REPORTS = 0', | ||
'INFO: PASS = 0', | ||
'INFO: FAIL = 0', | ||
'INFO: UNKNOWN = 0', | ||
'INFO: NA = 0', | ||
'INFO: NOMAIL = 0', | ||
'INFO: MAILS = 0', | ||
'INFO: NEWAUTH = 0', | ||
'INFO: GOOD = 0', | ||
'INFO: BAD = 0', | ||
'INFO: TEST = 0', | ||
], "log written"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More tests => 9; | ||
use CPAN::Testers::WWW::Reports::Mailer; | ||
|
||
use lib 't'; | ||
use CTWRM_Testing; | ||
|
||
{ | ||
ok( my $obj = CTWRM_Testing::getObj(), "got object" ); | ||
|
||
my $f = File::Spec->catfile('t','_DBDIR','lastmail'); | ||
ok($obj->lastmail($f),'reset last mail file'); | ||
is($obj->lastmail,$f, 'reset last mail'); | ||
|
||
ok(!-f $f, 'lastmail not created'); | ||
is($obj->_get_lastid,0, 'new last id'); | ||
ok(-f $f, 'lastmail now exists'); | ||
ok($obj->_get_lastid(12), 'set last id'); | ||
is($obj->_get_lastid,12, 'get last id'); | ||
|
||
my ($counts,@log); | ||
my @lines = do { open FILE, '<', $obj->lastmail; <FILE> }; | ||
is($lines[0],12, 'read last id'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More tests => 5; | ||
use CPAN::Testers::WWW::Reports::Mailer; | ||
|
||
use lib 't'; | ||
use CTWRM_Testing; | ||
|
||
{ | ||
ok( my $obj = CTWRM_Testing::getObj(), "got object" ); | ||
|
||
is($obj->_get_author('Abstract-Meta-Class','0.11'),'ADRIANWIT','found author ADRIANWIT'); | ||
is($obj->_get_author('Acme-CPANAuthors-French','0.07'),'SAPER','found author SAPER'); | ||
is($obj->_get_author('Acme-Buffy','1.5'),'LBROCARD','found author LBROCARD'); | ||
is($obj->_get_author('AI-NeuralNet-Mesh','0.44'),'JBRYAN','found author JBRYAN'); | ||
} |
Oops, something went wrong.