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

Diff for /todotxt/Text-Todo/t/entry.t between version 1.1 and 1.3

version 1.1, 2009/07/10 23:26:14 version 1.3, 2009/07/13 18:50:37
Line 7 
Line 7 
 #       AUTHOR:  Andrew Fresh (AAF), andrew@cpan.org  #       AUTHOR:  Andrew Fresh (AAF), andrew@cpan.org
 #      COMPANY:  Red River Communications  #      COMPANY:  Red River Communications
 #      CREATED:  07/10/09 11:32:39  #      CREATED:  07/10/09 11:32:39
 #     REVISION:  $RedRiver$  #     REVISION:  $RedRiver: 20.entry.t,v 1.2 2009/07/11 15:58:13 andrew Exp $
 #===============================================================================  #===============================================================================
   
 use strict;  use strict;
Line 29 
Line 29 
 is_deeply( [ $e->projects ], [], "check projects are empty" );  is_deeply( [ $e->projects ], [], "check projects are empty" );
   
 my %sample = (  my %sample = (
     text => '(B) @home @work keep your shoulder to the grindstone +busywork',      text => '(B) @home @work send email to andrew@cpan.org +say_thanks',
     priority    => 'B',      priority    => 'B',
     contexts    => [ 'home', 'work' ],      contexts    => [ 'home', 'work' ],
     projects    => ['busywork'],      projects    => ['say_thanks'],
     prepend     => 'before',      prepend     => 'before',
     append      => 'or something',      append      => 'or something',
     new_project => 'notnapping',      new_project => 'notnapping',
Line 46 
Line 46 
 is_deeply( [ $e->projects ], $sample{projects}, "check projects" );  is_deeply( [ $e->projects ], $sample{projects}, "check projects" );
   
 $sample{text} =~ s/^( \s* \( $sample{priority} \))/$1 $sample{prepend}/xms;  $sample{text} =~ s/^( \s* \( $sample{priority} \))/$1 $sample{prepend}/xms;
 ok( $e->prepend( $sample{prepend} ), 'prepend entry' );  ok( $e->prepend( $sample{prepend} ), 'Prepend entry' );
 is( $e->text,     $sample{text},     "Make sure entry matches" );  is( $e->text,     $sample{text},     "Make sure entry matches" );
 is( $e->priority, $sample{priority}, "check priority" );  is( $e->priority, $sample{priority}, "check priority" );
 is_deeply( [ $e->contexts ], $sample{contexts}, "check contexts" );  is_deeply( [ $e->contexts ], $sample{contexts}, "check contexts" );
 is_deeply( [ $e->projects ], $sample{projects}, "check projects" );  is_deeply( [ $e->projects ], $sample{projects}, "check projects" );
   
 $sample{text} .= ' ' . $sample{append};  $sample{text} .= ' ' . $sample{append};
 ok( $e->append( $sample{append} ), 'append entry' );  ok( $e->append( $sample{append} ), 'Append entry' );
 is( $e->text,     $sample{text},     "Make sure entry matches" );  is( $e->text,     $sample{text},     "Make sure entry matches" );
 is( $e->priority, $sample{priority}, "check priority" );  is( $e->priority, $sample{priority}, "check priority" );
 is_deeply( [ $e->contexts ], $sample{contexts}, "check contexts" );  is_deeply( [ $e->contexts ], $sample{contexts}, "check contexts" );
Line 62 
Line 62 
 ok( !$e->in_project( $sample{new_project} ), 'not in new project yet' );  ok( !$e->in_project( $sample{new_project} ), 'not in new project yet' );
 push @{ $sample{projects} }, $sample{new_project};  push @{ $sample{projects} }, $sample{new_project};
 $sample{text} .= ' +' . $sample{new_project};  $sample{text} .= ' +' . $sample{new_project};
 ok( $e->append( '+' . $sample{new_project} ), 'add project' );  ok( $e->append( '+' . $sample{new_project} ), 'Add project' );
 is( $e->text, $sample{text}, "Make sure entry matches" );  is( $e->text, $sample{text}, "Make sure entry matches" );
 ok( $e->in_project( $sample{new_project} ), 'now in new project' );  ok( $e->in_project( $sample{new_project} ), 'now in new project' );
   
 ok( !$e->in_context( $sample{new_context} ), 'not in new context yet' );  ok( !$e->in_context( $sample{new_context} ), 'not in new context yet' );
 push @{ $sample{contexts} }, $sample{new_context};  push @{ $sample{contexts} }, $sample{new_context};
 $sample{text} .= ' @' . $sample{new_context};  $sample{text} .= ' @' . $sample{new_context};
 ok( $e->append( '@' . $sample{new_context} ), 'add context' );  ok( $e->append( '@' . $sample{new_context} ), 'Add context' );
 is( $e->text, $sample{text}, "Make sure entry matches" );  is( $e->text, $sample{text}, "Make sure entry matches" );
 ok( $e->in_context( $sample{new_context} ), 'now in new context' );  ok( $e->in_context( $sample{new_context} ), 'now in new context' );

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

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