/[Frey]/trunk/lib/Frey/Test/Runner.pm
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/lib/Frey/Test/Runner.pm

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

revision 486 by dpavlin, Mon Nov 24 15:36:00 2008 UTC revision 491 by dpavlin, Mon Nov 24 18:29:41 2008 UTC
# Line 10  use TAP::Formatter::HTML; Line 10  use TAP::Formatter::HTML;
10  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
11    
12  use Frey::SVK;  use Frey::SVK;
13    use Frey::PPI;
14    
15  has tests => (  has tests => (
16          is => 'rw',          is => 'rw',
# Line 26  sub as_markup { Line 27  sub as_markup {
27          my ($self) = @_;          my ($self) = @_;
28    
29          my $f = TAP::Formatter::HTML->new({          my $f = TAP::Formatter::HTML->new({
30                  silent => 1,  #               silent => 1,
31    
32                  inline_css => 1,                  inline_css => 1,
33                  inline_js => 1,                  inline_js  => 0,
34          });          });
35          my $h = TAP::Harness->new({          my $h = TAP::Harness->new({
36                  merge => 1,                  merge => 1,
37                  formatter => $f,                  formatter => $f,
38          });          });
39    
40          my @tests =          my $tests;
41                  grep { ! m{$0} } # FIXME privitive way to break recursion  
42                  grep { m{\.t$} } # take just tests          map {
43                  @{ $self->tests };                  $tests->{$_}++ if m{\.t$};
44            } @{ $self->tests };
45    
46            map {
47                    if ( m{(.+)\.pm$} ) {
48                            my $class = $1;
49                            $class =~ s{^lib/}{};
50                            $class =~ s{/}{::}g;
51                            warn "extract tests from $_ class $class";
52                            $tests->{$_}++ foreach Frey::PPI->new( class => $class )->has_tests;
53                    }
54            } @{ $self->tests };
55    
56            my @tests = grep {
57                    ! m{$0} # break recursion      
58            } sort keys %$tests;
59            die "no tests for files ", dump( $self->tests ),dump( $tests ) unless @tests;
60    
61          warn "testing ",dump( @tests );          warn "testing ",dump( @tests );
62          $h->runtests( @tests );          $h->runtests( @tests );
63    
64          $self->store( 'var/test.yaml', $h );          $self->store( 'var/test/' . time() . '.yaml', $h );
65    
66          my $html = ${ $f->html };          my $html = ${ $f->html };
67  #       warn $html;  #       warn $html;

Legend:
Removed from v.486  
changed lines
  Added in v.491

  ViewVC Help
Powered by ViewVC 1.1.26