=================================================================== RCS file: /cvs/todotxt/Text-Todo/t/read_todo.t,v retrieving revision 1.3 retrieving revision 1.9 diff -u -r1.3 -r1.9 --- todotxt/Text-Todo/t/read_todo.t 2010/01/06 19:54:56 1.3 +++ todotxt/Text-Todo/t/read_todo.t 2010/01/15 19:44:32 1.9 @@ -8,14 +8,14 @@ # AUTHOR: Andrew Fresh (AAF), andrew@cpan.org # COMPANY: Red River Communications # CREATED: 07/09/09 11:45:52 -# REVISION: $RedRiver: 50.read_todo.t,v 1.2 2009/07/13 17:50:37 andrew Exp $ +# REVISION: $AFresh1: read_todo.t,v 1.8 2010/01/11 19:52:06 andrew Exp $ #=============================================================================== use strict; use warnings; use File::Spec; use File::Temp qw/ tempdir /; -use Test::More tests => 106; +use Test::More tests => 138; my $todo_file = File::Spec->catfile( 't', 'todo1.txt' ); my $tempdir = tempdir( 'todotxt-XXXXXXX', CLEANUP => 1 ); @@ -28,39 +28,51 @@ priority => 'B', contexts => ['phone'], projects => ['GarageSale'], - complete => undef, + done => undef, }, { text => '+GarageSale @home post signs around the neighborhood DUE:2006-08-01', priority => undef, contexts => ['home'], projects => ['GarageSale'], - complete => undef, + done => undef, }, { text => 'X eat meatballs @home', priority => undef, contexts => ['home'], projects => [], - complete => 'X', + done => 'X', }, { text => '(A) @phone thank Mom for the meatballs WAIT', priority => 'A', contexts => ['phone'], projects => [], - complete => undef, + done => undef, }, + { text => '', + priority => undef, + contexts => [], + projects => [], + done => undef, + }, { text => '@shopping Eskimo pies', priority => undef, contexts => ['shopping'], projects => [], - complete => undef, + done => undef, }, { text => 'email andrew@cpan.org for help +report_bug @wherever', priority => undef, contexts => ['wherever'], projects => ['report_bug'], - complete => undef, + done => undef, }, + { text => 'x 2009-01-01 completed with a date', + priority => undef, + contexts => [], + projects => [], + done => '2009-01-01', + }, ); my %extra_todo = ( @@ -68,10 +80,10 @@ priority => undef, contexts => ['continually'], projects => ['test+everything'], - complete => undef, + done => undef, ); -BEGIN: { use_ok( 'Text::Todo', 'use Text::Todo' ) } +BEGIN { use_ok( 'Text::Todo', 'use Text::Todo' ) } diag("Testing read Text::Todo $Text::Todo::VERSION"); @@ -101,24 +113,24 @@ ok( $list = $t->list, 'Get list from ' . $file ); for my $id ( 0 .. $#todos ) { - test_todo( $todos[$id], $list->[$id], $id); + test_todo( $todos[$id], $list->[$id], $id ); } } sub test_todo { - my ($sample, $read, $id) = @_; + my ( $sample, $read, $id ) = @_; - is( $read->text, $sample->{text}, "check text [$id]" ); - is( $read->priority, $sample->{priority}, "check priority [$id]" ); - is( $read->completed, $sample->{complete}, "check completion [$id]" ); - is_deeply( - [ $read->contexts ], - $sample->{contexts}, - "check contexts [$id]" - ); - is_deeply( - [ $read->projects ], - $sample->{projects}, - "check projects [$id]" - ); - } + is( $read->text, $sample->{text}, "check text [$id]" ); + is( $read->priority, $sample->{priority}, "check priority [$id]" ); + is( $read->done, $sample->{done}, "check completion [$id]" ); + is_deeply( + [ $read->contexts ], + $sample->{contexts}, + "check contexts [$id]" + ); + is_deeply( + [ $read->projects ], + $sample->{projects}, + "check projects [$id]" + ); +}