--- trunk/t/02-frey-ppi.t 2008/11/08 16:12:39 331 +++ branches/zimbardo/t/02-Frey-PPI.t 2009/07/05 21:40:16 1172 @@ -4,7 +4,7 @@ my $debug = @ARGV ? 1 : 0; -use Test::More tests => 5; +use Test::More tests => 21; use lib 'lib'; use Data::Dump qw/dump/; @@ -13,10 +13,43 @@ use_ok('Frey::PPI'); } -ok( my $o = Frey::PPI->new( class => 'Frey::DelIcioUs', debug => $debug ), 'new' ); -ok( my @order = $o->attribute_order, 'attribute_order' ); -diag dump( @order ) if $debug; -is_deeply( [ @order ], [ 'username', 'password', 'path' ], 'order correct' ); -ok( my $data = $o->data, 'data' ); -diag dump( $data ) if $debug; +my $test = { + 'Frey::DelIcioUs' => { + attribute_order => ["username", "password"], + includes => { + "use" => ["Moose", "LWP::UserAgent", "XML::Simple", "Data::Dump"], + }, + }, + 'Frey::Feed' => { + attribute_order => ["uri", "feed", "title"], + includes => { + "use" => [ "Moose", "Frey::Types", "Frey::Mirror", "XML::FeedPP", "Data::Dump" ], + }, + has_tests => ["t/06-Frey-Feed.t"], + }, + 'App::RoomReservation' => { + attribute_order => [], + includes => { "use" => ["Moose", "App::RoomReservation::Room"] }, + has_tests => ["t/App/RoomReservation.t"], + } +}; + +foreach my $class ( keys %$test ) { + + ok( my $o = Frey::PPI->new( class => $class, debug => $debug ), "new $class" ); + + my $data; + + ok( $data->{attribute_order} = $o->attribute_order, 'attribute_order' ); + ok( $data->{includes} = $o->includes, 'includes' ); + $data->{has_tests} = [ $o->has_tests ] if $o->has_tests; + diag "data $class = ",dump( $data ) if $debug; + + foreach ( keys %$data ) { + is_deeply( $data->{$_}, $test->{$class}->{$_}, $_ ); + } + ok( $data = $o->as_data, 'data' ); + diag dump( $data ) if $debug; + +}