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

Annotation of todotxt/Text-Todo/t/read_todo.t, Revision 1.2

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
1.2     ! andrew     11: #     REVISION:  $RedRiver: 50.read_todo.t,v 1.1 2009/07/10 22:26:14 andrew Exp $
1.1       andrew     12: #===============================================================================
                     13:
                     14: use strict;
                     15: use warnings;
                     16: use File::Spec;
1.2     ! andrew     17: use Test::More tests => 28;
1.1       andrew     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 => [],
1.2     ! andrew     46:     },
        !            47:     {   text     => 'email andrew@cpan.org for help +report_bug @wherever',
        !            48:         priority => undef,
        !            49:         contexts => ['wherever'],
        !            50:         projects => ['report_bug'],
1.1       andrew     51:     },
                     52: );
                     53:
                     54: BEGIN: { use_ok( 'Text::Todo', 'use Text::Todo' ) }
                     55:
                     56: diag("Testing 50 read Text::Todo $Text::Todo::VERSION");
                     57:
                     58: my $todo = new_ok('Text::Todo');
                     59:
                     60: #ok( $todo->load(), 'Load no file');
                     61:
                     62: ok( $todo->load($todo_file), "Load file [$todo_file]" );
                     63:
                     64: my $list;
                     65: ok( $list = $todo->list, 'Get list' );
                     66:
                     67: for my $id ( 0 .. $#todos ) {
                     68:     my $sample = $todos[$id];
                     69:     my $read   = $list->[$id];
                     70:
                     71:     is( $read->text,     $sample->{text},     "check text [$id]" );
                     72:     is( $read->priority, $sample->{priority}, "check priority [$id]" );
                     73:     is_deeply(
                     74:         [ $read->contexts ],
                     75:         $sample->{contexts},
                     76:         "check contexts [$id]"
                     77:     );
                     78:     is_deeply(
                     79:         [ $read->projects ],
                     80:         $sample->{projects},
                     81:         "check projects [$id]"
                     82:     );
                     83: }

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