| version 1.3, 2010/01/09 06:26:43 |
version 1.8, 2010/01/10 22:39:26 |
|
|
| # AUTHOR: Andrew Fresh (AAF), andrew@cpan.org |
# AUTHOR: Andrew Fresh (AAF), andrew@cpan.org |
| # COMPANY: Red River Communications |
# COMPANY: Red River Communications |
| # CREATED: 01/07/10 19:11 |
# CREATED: 01/07/10 19:11 |
| # REVISION: $RedRiver: list.t,v 1.2 2010/01/09 05:00:21 andrew Exp $ |
# REVISION: $RedRiver: list.t,v 1.7 2010/01/10 19:29:17 andrew Exp $ |
| #=============================================================================== |
#=============================================================================== |
| |
|
| use strict; |
use strict; |
| use warnings; |
use warnings; |
| |
|
| use Test::More; #tests => 2; |
use Test::More tests => 53; |
| |
|
| use File::Temp qw/ tempdir /; |
use File::Temp qw/ tempdir /; |
| use Data::Dumper; |
use Data::Dumper; |
|
|
| $orig = undef; |
$orig = undef; |
| |
|
| my @pri_list; |
my @pri_list; |
| ok( @pri_list = $copy->listpri, 'load priority item' ); |
ok( @pri_list = $copy->listpri('A'), 'list priority item' ); |
| is( scalar @pri_list, 1, 'only 1 item in the priority list' ); |
is( scalar @pri_list, 1, 'only 1 item in the priority list' ); |
| is( $pri_list[0]->text, '(A) entry 1 @one +uno', 'priority item is correct' ); |
is( $pri_list[0]->text, '(A) entry 1 @one +uno', 'priority item is correct' ); |
| |
|
|
|
| } |
} |
| } |
} |
| |
|
| @projects; |
|
| ok( @projects = $copy->listproj, 'listproj for current list' ); |
ok( @projects = $copy->listproj, 'listproj for current list' ); |
| is_deeply( \@projects, [ 'dos', 'uno' ], 'got the projects we expected' ); |
is_deeply( \@projects, [ 'dos', 'uno' ], 'got the projects we expected' ); |
| |
|
| |
my @contexts; |
| |
ok( @contexts = $copy->listcon, 'listcon for current list' ); |
| |
is_deeply( \@contexts, [ 'one', 'two' ], 'got the contexts we expected' ); |
| |
|
| my $entry_to_archive; |
my $entry_to_archive; |
| ok( $entry_to_archive = $copy->list->[1], 'read entry_to_archive' ); |
ok( $entry_to_archive = $copy->list->[3], 'read entry_to_archive' ); |
| is( $entry_to_archive->text, |
is( $entry_to_archive->text, |
| 'x completed entry 3', |
'x completed entry 4', |
| 'make sure we got the right entry' |
'make sure we got the right entry' |
| ); |
); |
| |
|
| TODO: { |
ok( $copy->archive, 'archive done items' ); |
| local $TODO = 'No tests for archive and it isn\'t even written yet'; |
isnt( $copy->list->[1]->text, |
| ok( $copy->archive ); |
$entry_to_archive->text, 'make sure it changed' ); |
| isnt( $copy->list->[1]->text, |
|
| $entry_to_archive->text, 'make sure it changed' ); |
|
| |
|
| SKIP: { |
ok( $copy->load('done_file'), 'read the done_file' ); |
| skip 'unable to load done_file', 1 |
is( $copy->list->[-1]->text, |
| if !ok( $copy->load('done_file'), 'read the done_file' ); |
$entry_to_archive->text, 'make sure it moved to the archive' ); |
| is( $copy->list->[-1]->text, |
|
| $entry_to_archive->text, 'make sure it moved to the archive' ); |
|
| } |
|
| } |
|
| |
|
| my $file; |
my $file; |
| ok( $file = $copy->file('done_file'), 'get the done_file name' ); |
ok( $file = $copy->file('done_file'), 'get the done_file name' ); |
| is( $file, $todo_dir . '/done.txt', 'the done_file name what we expected?' ); |
is( $file, $todo_dir . '/done.txt', 'the done_file name what we expected?' ); |
| |
|
| ok( $copy->addto( $file, 'added text' ) ); |
ok( $copy->addto( $file, 'added text' ), 'Add text to file' ); |
| |
|
| my @done; |
my @done; |
| ok( @done = $copy->listfile('done_file'), 'get items in done_file' ); |
ok( @done = $copy->listfile('done_file'), 'get items in done_file' ); |
| is( $done[-1]->text, 'added text', 'make sure what we added is there' ); |
is( $done[-1]->text, 'added text', 'make sure what we added is there' ); |
| |
|
| #is( $done[-2]->text, $entry_to_archive->text, |
is( $done[-2]->text, $entry_to_archive->text, |
| # 'make sure it moved to the archive' ); |
'make sure it moved to the archive' ); |
| |
|
| done_testing(); |
#done_testing(); |