/[Frey]/trunk/t/02-frey-ppi.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/02-frey-ppi.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 363 by dpavlin, Sat Nov 8 23:01:45 2008 UTC revision 364 by dpavlin, Sun Nov 16 19:50:36 2008 UTC
# Line 4  use warnings; Line 4  use warnings;
4    
5  my $debug = @ARGV ? 1 : 0;  my $debug = @ARGV ? 1 : 0;
6    
7  use Test::More tests => 5;  use Test::More tests => 13;
8  use lib 'lib';  use lib 'lib';
9    
10  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
# Line 14  BEGIN { Line 14  BEGIN {
14  }  }
15    
16  my $test = {  my $test = {
17          'Frey::DelIcioUs' => [ 'username', 'password' ],          'Frey::DelIcioUs' => {
18          'Frey::Feed' => [ 'uri' ],                  attribute_order => ["username", "password"],
19                    includes => {
20                            "use" => ["Moose", "LWP::UserAgent", "XML::Simple", "Data::Dump"],
21                    },
22            },
23            'Frey::Feed' => {
24                    attribute_order => ["uri", "feed", "title"],
25                    includes => {
26                            "use" => [ "Moose", "Frey::Types", "Frey::Mirror", "Data::Feed", "Data::Dump" ],
27                    },
28            },
29  };  };
30    
31  foreach my $class ( keys %$test ) {  foreach my $class ( keys %$test ) {
32    
33          ok( my $o = Frey::PPI->new( class => $class, debug => $debug ), "new $class" );          ok( my $o = Frey::PPI->new( class => $class, debug => $debug ), "new $class" );
34          ok( my @order = $o->attribute_order, 'attribute_order' );  
35          diag dump( @order ) if $debug;          my $data;
36          is_deeply( [ @order ], $test->{$class}, 'order correct' );  
37          ok( my $data = $o->data, 'data' );          ok( $data->{attribute_order} = $o->attribute_order, 'attribute_order' );
38            ok( $data->{includes} = $o->includes, 'includes' );
39            diag "data $class = ",dump( $data ) if $debug;
40    
41            foreach ( keys %$data ) {
42                    is_deeply( $data->{$_}, $test->{$class}->{$_}, $_ );
43            }
44    
45            ok( $data = $o->data, 'data' );
46          diag dump( $data ) if $debug;          diag dump( $data ) if $debug;
47    
48  }  }

Legend:
Removed from v.363  
changed lines
  Added in v.364

  ViewVC Help
Powered by ViewVC 1.1.26