[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.4 and 1.5

version 1.4, 2010/04/30 02:24:06 version 1.5, 2010/04/30 02:42:20
Line 29 
Line 29 
   
 my $t = Test::Mojo->new;  my $t = Test::Mojo->new;
   
   my @exts = ( q{}, '.html', '.txt', '.json' );
   
 foreach my $p (  foreach my $p (
     '/',      '/',
     '/l/todo1',      ( map { '/l/todo1' . $_ } @exts ),
     '/l/todo1.html',      ( map { '/l/todo1/e/1' . $_ } @exts ),
     '/l/todo1.txt',      ( map { '/l/todo1/e/4' . $_ } @exts ),
     '/l/todo1.json',      ( map { '/l/todo1/t' . $_ } @exts ),
     '/l/todo1/e/1',      ( map { '/l/todo1/t/project' . $_ } @exts ),
     '/l/todo1/e/1.html',      ( map { '/l/todo1/t/context' . $_ } @exts ),
     '/l/todo1/e/1.json',      )
     '/l/todo1/t',  {
     '/l/todo1/t.txt',      my ( $volume, $directories, $file ) = File::Spec->splitpath($p);
     '/l/todo1/t.json',  
 ) {  
     my ($volume, $directories, $file) = File::Spec->splitpath($p);  
     $file ||= 'index.html';      $file ||= 'index.html';
       $file .= '.html' if $file !~ /\.[^.]+$/xms;
   
     if ($file !~ /\.[^.]+$/xms) {  
         $file .= '.html';  
     }  
   
   
     my $f = File::Spec->catfile( 't', 'dudelicious', $volume, $directories,      my $f = File::Spec->catfile( 't', 'dudelicious', $volume, $directories,
         $file);          $file );
   
     SKIP: {  SKIP: {
         skip "$f does not exist", 3 if ! -e $f;          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 ) );          diag("Getting [$f] from [$p]");
           open my $fh, '<', $f or die $f . ': ' . $!;
           $t->get_ok($p)->status_is(200)->content_is(
               do { local $/; <$fh> }
           );
           close $fh;
     }      }
 }  }
   
 done_testing();  done_testing();
   
   
 sub slurp {  
     my ($file) = @_;  
   
     local $/;  
     open my $fh, '<', $file or die $file . ': ' . $!;  
     my $content = <$fh>;  
     close $fh;  
   
     return $content;  
 }  

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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