Annotation of todotxt/Text-Todo-REST-API/t/GET/tags.t, Revision 1.7
1.1 andrew 1: #===============================================================================
2: #
3: # FILE: GET/tags.t
4: #
5: # DESCRIPTION: Test Text::Todo::REST::API
6: #
7: # AUTHOR: Andrew Fresh (AAF), andrew@cpan.org
8: # COMPANY: Red River Communications
9: # CREATED: 01/07/10 19:11
1.7 ! andrew 10: # REVISION: $AFresh1: tags.t,v 1.6 2010/01/26 06:03:11 andrew Exp $
1.1 andrew 11: #===============================================================================
12:
13: use strict;
14: use warnings;
15:
1.7 ! andrew 16: use Test::More tests => 10;
1.5 andrew 17: my $api_class;
18: my $class;
1.1 andrew 19:
20: BEGIN {
1.5 andrew 21: $api_class = 'Text::Todo::REST::API';
1.6 andrew 22: $class = 'Text::Todo::REST::API::Actions::GET';
1.5 andrew 23:
24: use_ok( $api_class, "use $api_class" );
1.6 andrew 25: use_ok( $class, "use $class" );
1.1 andrew 26: }
27:
1.5 andrew 28: diag("Testing GET tags $class $Text::Todo::REST::API::Actions::GET::VERSION");
1.1 andrew 29:
1.5 andrew 30: my $api = new_ok( $api_class, [ { todo_dir => 't/lists' } ] );
1.6 andrew 31: my $action = new_ok($class);
1.1 andrew 32:
33: my %tags = (
1.7 ! andrew 34: undef => { 'context' => '@', 'project' => '+' },
1.6 andrew 35: project => [ 'delete', 'dos', 'uno' ],
36: context => [ 'one', 'two' ],
1.1 andrew 37: );
38:
1.7 ! andrew 39: foreach my $key ( keys %tags ) {
! 40: my $tag = $key;
! 41: if ($tag eq 'undef') {
! 42: $tag = undef;
! 43: }
! 44:
1.4 andrew 45: my $tags;
1.7 ! andrew 46: ok( $tags = $action->get_tags( $api->_todo, $tag ), "Get [$key] tags" );
! 47: is_deeply( $tags, $tags{$key}, 'got expected ' . $key. 's' );
1.1 andrew 48: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>