=================================================================== RCS file: /cvs/todotxt/Text-Todo/t/dudelicious.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- todotxt/Text-Todo/t/dudelicious.t 2010/04/29 05:50:33 1.3 +++ todotxt/Text-Todo/t/dudelicious.t 2010/04/30 02:24:06 1.4 @@ -29,68 +29,48 @@ my $t = Test::Mojo->new; -# Index page -$t->get_ok('/')->status_is(200)->content_like(qr/todo1\.txt/xms); -$t->get_ok('/l/todo1')->status_is(200)->content_is( - q{ - Funky! -

todo1

-
    -
  1. -(B) +GarageSale @phone schedule Goodwill pickup -
  2. -
  3. -+GarageSale @home post signs around the neighborhood DUE:2006-08-01 -
  4. -
  5. -X eat meatballs @home -
  6. -
  7. -(A) @phone thank Mom for the meatballs WAIT -
  8. -
  9. +foreach my $p ( + '/', + '/l/todo1', + '/l/todo1.html', + '/l/todo1.txt', + '/l/todo1.json', + '/l/todo1/e/1', + '/l/todo1/e/1.html', + '/l/todo1/e/1.json', + '/l/todo1/t', + '/l/todo1/t.txt', + '/l/todo1/t.json', +) { + my ($volume, $directories, $file) = File::Spec->splitpath($p); + $file ||= 'index.html'; -
  10. -
  11. -@shopping Eskimo pies -
  12. -
  13. -email andrew@cpan.org for help +report_bug @wherever -
  14. -
  15. -x 2009-01-01 completed with a date -
  16. -
- - -} -); + if ($file !~ /\.[^.]+$/xms) { + $file .= '.html'; + } -$t->get_ok('/l/todo1.txt')->status_is(200)->content_is( - q{(B) +GarageSale @phone schedule Goodwill pickup -+GarageSale @home post signs around the neighborhood DUE:2006-08-01 -X eat meatballs @home -(A) @phone thank Mom for the meatballs WAIT -@shopping Eskimo pies -email andrew@cpan.org for help +report_bug @wherever -x 2009-01-01 completed with a date -} -); + my $f = File::Spec->catfile( 't', 'dudelicious', $volume, $directories, + $file); -$t->get_ok('/l/todo1/e/1')->status_is(200)->content_is( - q{ - Funky! - (B) +GarageSale @phone schedule Goodwill pickup - - + SKIP: { + skip "$f does not exist", 3 if ! -e $f; + diag( "Getting [$f] from [$p]" ); + $t->get_ok($p)->status_is(200)->content_is( slurp( $f ) ); + } } -); -$t->get_ok('/l/todo1/e/1.txt')->status_is(200)->content_is( - q{(B) +GarageSale @phone schedule Goodwill pickup -} -); - done_testing(); + + +sub slurp { + my ($file) = @_; + + local $/; + open my $fh, '<', $file or die $file . ': ' . $!; + my $content = <$fh>; + close $fh; + + return $content; +}