| version 1.9, 2010/01/10 22:52:32 |
version 1.13, 2010/01/15 19:50:15 |
|
|
| # AUTHOR: Andrew Fresh (AAF), andrew@cpan.org |
# AUTHOR: Andrew Fresh (AAF), andrew@cpan.org |
| # COMPANY: Red River Communications |
# COMPANY: Red River Communications |
| # CREATED: 07/10/09 11:32:39 |
# CREATED: 07/10/09 11:32:39 |
| # REVISION: $RedRiver: entry.t,v 1.8 2010/01/09 07:07:31 andrew Exp $ |
# REVISION: $AFresh1: entry.t,v 1.12 2010/01/15 19:44:32 andrew Exp $ |
| #=============================================================================== |
#=============================================================================== |
| |
|
| use strict; |
use strict; |
|
|
| |
|
| use Test::More tests => 40; |
use Test::More tests => 40; |
| |
|
| my $class = 'Text::Todo::Entry'; |
my $class; |
| |
BEGIN { |
| |
$class = 'Text::Todo::Entry'; |
| |
use_ok( $class, "use $class" ) |
| |
} |
| |
|
| BEGIN: { use_ok( $class, "use $class" ) } |
|
| |
|
| diag("Testing entry $class $Text::Todo::Entry::VERSION"); |
diag("Testing entry $class $Text::Todo::Entry::VERSION"); |
| |
|
| my %sample = ( |
my %sample = ( |
|
|
| is( $e->text, $sample{text}, 'Make sure entry matches' ); |
is( $e->text, $sample{text}, 'Make sure entry matches' ); |
| is( $e->priority, undef, 'New priority is set' ); |
is( $e->priority, undef, 'New priority is set' ); |
| |
|
| |
my $done_date = sprintf "%04d-%02d-%02d", |
| |
( (localtime)[5] + 1900 ), |
| |
( (localtime)[4] + 1 ), |
| |
( (localtime)[3] ); |
| |
my $done_marker = "x $done_date "; |
| |
|
| ok( !$e->done, 'not done' ); |
ok( !$e->done, 'not done' ); |
| ok( $e->do, 'mark as done' ); |
ok( $e->do, 'mark as done' ); |
| ok( $e->done, 'now done' ); |
is( $e->done, $done_date, 'now done' ); |
| is( $e->text, 'x ' . $sample{text}, 'Make sure entry matches' ); |
is( $e->text, $done_marker . $sample{text}, 'Make sure entry matches' ); |
| |
|
| ok( $e->replace(''), 'Blank entry' ); |
ok( $e->replace(''), 'Blank entry' ); |
| is( $e->text, '', 'Make sure entry is blank' ); |
is( $e->text, '', 'Make sure entry is blank' ); |