--- trunk/lib/Frey/Test/Runner.pm 2008/11/24 22:56:41 506 +++ trunk/lib/Frey/Test/Runner.pm 2008/11/26 03:22:21 528 @@ -30,7 +30,8 @@ documentation => 'run only this single test', ); -has depends => ( +has test_because => ( + documentation => 'returns classes responsable for each test run', is => 'rw', # isa => 'HashRef[Hashref[Int]', required => 1, @@ -59,9 +60,14 @@ }, ); +our $running; + sub as_markup { my ($self) = @_; + return 'allready running' if $running; + $running = 1; + my $f = TAP::Formatter::HTML->new({ # silent => 1, @@ -77,18 +83,23 @@ @tests = ( $self->test ) if $self->test; - @tests = grep { - ! m{$0} # break recursion - } sort keys %{ $self->depends } unless @tests; + if ( my $depends = $self->test_because ) { + @tests = grep { + $_ ne '' && + ! m{$0} # break recursion + } sort keys %{ $depends } unless @tests; + } - push @{ $self->status }, { test => { depends => $self->depends } }; # FIXME + $self->add_status( { test => { depends => $self->test_because } } ); if ( ! @tests ) { - warn "can't find any tests ", dump( $self->tests ), " within depends ", dump( $self->depends ); + warn "can't find any tests ", dump( $self->tests ), " within depends ", dump( $self->test_because ); warn "running all tests instead"; @tests = glob('t/*.t'); } + $self->title( join(' ', @tests ) ); + warn "testing ",dump( @tests ); $h->runtests( @tests ); @@ -99,7 +110,9 @@ warn "got ",length($html), " bytes"; while ( $html =~ s{()}{}gs ) { - $self->add_head( $1 ); + my $style = $1; + $style =~ s[((?:body|html)\s+{[^}]+})][/\* $1 \*/]sg; # remove some styles + $self->add_head( $style ); } $self->add_head(qq| @@ -109,18 +122,21 @@ td.results:hover ul.test-out { display: block; } |); + $html =~ s{}{}sg; # remove menu which doesn't work without JavaScript $html =~ s{^.*}{}s; $html =~ s{.*$}{}s; $html =~ s{(t/(.+?)}{$3}sg; - return - $self->editor_links( $html ) - . qq|Test dependencies: