Annotation of todotxt/Text-Todo/t/read_todo.t, Revision 1.1
1.1 ! andrew 1: #
! 2: #===============================================================================
! 3: #
! 4: # FILE: 50.read_todo.t
! 5: #
! 6: # DESCRIPTION: Reads in a sample todo.txt and makes sure it got it correctly
! 7: #
! 8: # AUTHOR: Andrew Fresh (AAF), andrew@cpan.org
! 9: # COMPANY: Red River Communications
! 10: # CREATED: 07/09/09 11:45:52
! 11: # REVISION: $RedRiver$
! 12: #===============================================================================
! 13:
! 14: use strict;
! 15: use warnings;
! 16: use File::Spec;
! 17: use Test::More tests => 24;
! 18:
! 19: my $todo_file = File::Spec->catfile( 't', 'todo1.txt' );
! 20: my @todos = (
! 21: { text => '(B) +GarageSale @phone schedule Goodwill pickup',
! 22: priority => 'B',
! 23: contexts => ['phone'],
! 24: projects => ['GarageSale'],
! 25: },
! 26: { text =>
! 27: '+GarageSale @home post signs around the neighborhood DUE:2006-08-01',
! 28: priority => undef,
! 29: contexts => ['home'],
! 30: projects => ['GarageSale'],
! 31: },
! 32: { text => 'eat meatballs @home',
! 33: priority => undef,
! 34: contexts => ['home'],
! 35: projects => [],
! 36: },
! 37: { text => '(A) @phone thank Mom for the meatballs WAIT',
! 38: priority => 'A',
! 39: contexts => ['phone'],
! 40: projects => [],
! 41: },
! 42: { text => '@shopping Eskimo pies',
! 43: priority => undef,
! 44: contexts => ['shopping'],
! 45: projects => [],
! 46: },
! 47: );
! 48:
! 49: BEGIN: { use_ok( 'Text::Todo', 'use Text::Todo' ) }
! 50:
! 51: diag("Testing 50 read Text::Todo $Text::Todo::VERSION");
! 52:
! 53: my $todo = new_ok('Text::Todo');
! 54:
! 55: #ok( $todo->load(), 'Load no file');
! 56:
! 57: ok( $todo->load($todo_file), "Load file [$todo_file]" );
! 58:
! 59: my $list;
! 60: ok( $list = $todo->list, 'Get list' );
! 61:
! 62: for my $id ( 0 .. $#todos ) {
! 63: my $sample = $todos[$id];
! 64: my $read = $list->[$id];
! 65:
! 66: is( $read->text, $sample->{text}, "check text [$id]" );
! 67: is( $read->priority, $sample->{priority}, "check priority [$id]" );
! 68: is_deeply(
! 69: [ $read->contexts ],
! 70: $sample->{contexts},
! 71: "check contexts [$id]"
! 72: );
! 73: is_deeply(
! 74: [ $read->projects ],
! 75: $sample->{projects},
! 76: "check projects [$id]"
! 77: );
! 78: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>