[BACK]Return to dudelicious.t CVS log [TXT][DIR] Up to [local] / todotxt / Text-Todo / t

Diff for /todotxt/Text-Todo/t/dudelicious.t between version 1.3 and 1.9

version 1.3, 2010/04/29 05:50:33 version 1.9, 2010/05/05 02:24:20
Line 1 
Line 1 
 #!perl  #!perl
   # $AFresh1: dudelicious.t,v 1.8 2010/05/01 22:38:24 andrew Exp $
 use Test::More;    # tests => 3;  use Test::More;    # tests => 3;
   
 use strict;  use strict;
Line 8 
Line 9 
 use File::Copy qw/ cp /;  use File::Copy qw/ cp /;
 use File::Spec;  use File::Spec;
   
   my $have_test_json = 1;
   
 BEGIN {  BEGIN {
     eval "use Test::Mojo";      eval "use Test::Mojo";
     plan skip_all => "Test::Mojo required for testing dudelicious" if $@;      plan skip_all => "Test::Mojo required for testing dudelicious" if $@;
   
 }  }
   
 my $todo_dir = tempdir( 'todo-XXXXXXXXX', CLEANUP => 1, TMPDIR => 1 );  my $todo_dir = tempdir( 'todo-XXXXXXXXX', CLEANUP => 1, TMPDIR => 1 );
Line 29 
Line 31 
   
 my $t = Test::Mojo->new;  my $t = Test::Mojo->new;
   
 # Index page  my @exts = ( q{}, '.html', '.txt', '.json' );
 $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>      ( map { '/l/todo1' . $_ } @exts ),
     <body><h1>todo1</h1>      ( map { '/l/todo1/e/1' . $_ } @exts ),
 <ol>      ( map { '/l/todo1/e/4' . $_ } @exts ),
     <li>      ( map { '/l/todo1/t' . $_ } @exts ),
 (B) +GarageSale @phone schedule Goodwill pickup      ( map { '/l/todo1/t/project' . $_ } @exts ),
     </li>      ( map { '/l/todo1/t/context' . $_ } @exts ),
     <li>      )
 +GarageSale @home post signs around the neighborhood DUE:2006-08-01  {
     </li>      my ( $volume, $directories, $file ) = File::Spec->splitpath($p);
     <li>  
 X eat meatballs @home  
     </li>  
     <li>  
 (A) @phone thank Mom for the meatballs WAIT  
     </li>  
     <li>  
   
     </li>      $file ||= 'index.html';
     <li>      $file .= '.html' if $file !~ /\.[^.]+$/xms;
 @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(      my $f = File::Spec->catfile( 't', 'dudelicious', $volume, $directories,
     q{(B) +GarageSale @phone schedule Goodwill pickup          $file );
 +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  SKIP: {
 email andrew@cpan.org for help +report_bug @wherever          skip "$f does not exist", 3 if !-e $f;
 x 2009-01-01 completed with a date  
 }  
 );  
   
 $t->get_ok('/l/todo1/e/1')->status_is(200)->content_is(          open my $fh, '<', $f or die $f . ': ' . $!;
     q{<!doctype html><html>          my $content = do { local $/; <$fh> };
     <head><title>Funky!</title></head>          close $fh;
     <body>(B) +GarageSale @phone schedule Goodwill pickup  
 </body>  
 </html>  
 }  
 );  
   
 $t->get_ok('/l/todo1/e/1.txt')->status_is(200)->content_is(          $t->get_ok( $p, {}, undef, "Get [$f] from [$p]" )
     q{(B) +GarageSale @phone schedule Goodwill pickup              ->status_is(200, 'With 200 status');
   
           if ( $f =~ /\.json$/xms ) {
               $t->json_content_is( Mojo::JSON->decode($content),
                   'Check JSON content' );
           }
           else {
               $t->content_like( qr/\Q$content\E/xms, 'Check content' );
           }
       }
 }  }
 );  
   
 done_testing();  done_testing();

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.9

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>