version 1.3, 2010/04/29 05:50:33 |
version 1.4, 2010/04/30 02:24:06 |
|
|
|
|
my $t = Test::Mojo->new; |
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( |
foreach my $p ( |
q{<!doctype html><html> |
'/', |
<head><title>Funky!</title></head> |
'/l/todo1', |
<body><h1>todo1</h1> |
'/l/todo1.html', |
<ol> |
'/l/todo1.txt', |
<li> |
'/l/todo1.json', |
(B) +GarageSale @phone schedule Goodwill pickup |
'/l/todo1/e/1', |
</li> |
'/l/todo1/e/1.html', |
<li> |
'/l/todo1/e/1.json', |
+GarageSale @home post signs around the neighborhood DUE:2006-08-01 |
'/l/todo1/t', |
</li> |
'/l/todo1/t.txt', |
<li> |
'/l/todo1/t.json', |
X eat meatballs @home |
) { |
</li> |
my ($volume, $directories, $file) = File::Spec->splitpath($p); |
<li> |
$file ||= 'index.html'; |
(A) @phone thank Mom for the meatballs WAIT |
|
</li> |
|
<li> |
|
|
|
</li> |
if ($file !~ /\.[^.]+$/xms) { |
<li> |
$file .= '.html'; |
@shopping Eskimo pies |
} |
</li> |
|
<li> |
|
email andrew@cpan.org for help +report_bug @wherever |
|
</li> |
|
<li> |
|
x 2009-01-01 completed with a date |
|
</li> |
|
</ol> |
|
</body> |
|
</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 |
my $f = File::Spec->catfile( 't', 'dudelicious', $volume, $directories, |
email andrew@cpan.org for help +report_bug @wherever |
$file); |
x 2009-01-01 completed with a date |
|
} |
|
); |
|
|
|
$t->get_ok('/l/todo1/e/1')->status_is(200)->content_is( |
SKIP: { |
q{<!doctype html><html> |
skip "$f does not exist", 3 if ! -e $f; |
<head><title>Funky!</title></head> |
diag( "Getting [$f] from [$p]" ); |
<body>(B) +GarageSale @phone schedule Goodwill pickup |
$t->get_ok($p)->status_is(200)->content_is( slurp( $f ) ); |
</body> |
} |
</html> |
|
} |
} |
); |
|
|
|
$t->get_ok('/l/todo1/e/1.txt')->status_is(200)->content_is( |
|
q{(B) +GarageSale @phone schedule Goodwill pickup |
|
} |
|
); |
|
|
|
done_testing(); |
done_testing(); |
|
|
|
|
|
sub slurp { |
|
my ($file) = @_; |
|
|
|
local $/; |
|
open my $fh, '<', $file or die $file . ': ' . $!; |
|
my $content = <$fh>; |
|
close $fh; |
|
|
|
return $content; |
|
} |