/[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 507 by dpavlin, Tue Nov 25 00:26:15 2008 UTC revision 527 by dpavlin, Wed Nov 26 02:35:59 2008 UTC
# Line 59  has depends => ( Line 59  has depends => (
59          },          },
60  );  );
61    
62    our $running;
63    
64  sub as_markup {  sub as_markup {
65          my ($self) = @_;          my ($self) = @_;
66    
67            return 'allready running' if $running;
68            $running = 1;
69    
70          my $f = TAP::Formatter::HTML->new({          my $f = TAP::Formatter::HTML->new({
71  #               silent => 1,  #               silent => 1,
72    
# Line 79  sub as_markup { Line 84  sub as_markup {
84    
85          if ( my $depends = $self->depends ) {          if ( my $depends = $self->depends ) {
86                  @tests = grep {                  @tests = grep {
87                            $_ ne '' &&
88                          ! m{$0} # break recursion                                ! m{$0} # break recursion      
89                  } sort keys %{ $depends } unless @tests;                  } sort keys %{ $depends } unless @tests;
90          }          }
# Line 91  sub as_markup { Line 97  sub as_markup {
97                  @tests = glob('t/*.t');                  @tests = glob('t/*.t');
98          }          }
99    
100            $self->title( join(' ', @tests ) );
101    
102          warn "testing ",dump( @tests );          warn "testing ",dump( @tests );
103          $h->runtests( @tests );          $h->runtests( @tests );
104    
# Line 101  sub as_markup { Line 109  sub as_markup {
109          warn "got ",length($html), " bytes";          warn "got ",length($html), " bytes";
110    
111          while ( $html =~ s{(<style.+?/style>)}{}gs ) {          while ( $html =~ s{(<style.+?/style>)}{}gs ) {
112                  $self->add_head( $1 );                  my $style = $1;
113                    $style =~ s[((?:body|html)\s+{[^}]+})][/\* $1 \*/]sg; # remove some styles
114                    $self->add_head( $style );
115          }          }
116    
117          $self->add_head(qq|          $self->add_head(qq|
# Line 111  sub as_markup { Line 121  sub as_markup {
121                  td.results:hover ul.test-out { display: block; }                  td.results:hover ul.test-out { display: block; }
122                  </style>                  </style>
123          |);          |);
124            $html =~ s{<div id="menu">.+?</div>}{}sg; # remove menu which doesn't work without JavaScript
125    
126          $html =~ s{^.*<body>}{}s;          $html =~ s{^.*<body>}{}s;
127          $html =~ s{</body>.*$}{}s;          $html =~ s{</body>.*$}{}s;
128    
129          $html =~ s{(<a class="file") href="#"(.+?)>t/(.+?)</a>}{<a target="editor" href="/editor+t/$3.t+1" name="t/$3.t" $2>$3</a>}sg;          $html =~ s{(<a class="file") href="#"(.+?)>t/(.+?)</a>}{<a target="editor" href="/editor+t/$3.t+1" name="t/$3.t" $2>$3</a>}sg;
130    
131          return          $html = $self->editor_links( $html );
132                  $self->editor_links( $html )  
133                  . qq|Test dependencies:<ul><li>|          if ( my $depends = $self->depends ) {
134                    $html .= qq|Test dependencies:|
135                    . qq|<ul><li>|
136                  . join("</li>\n<li>",                  . join("</li>\n<li>",
137                          map {                          map {
138                                  qq|<a href="#$_"><tt>$_</tt></a> &larr; |                                  qq|<a href="?test=$_"><tt>$_</tt></a> &larr; |
139                                  .                                  .
140                                  join(' ',                                  join(' ',
141                                          map {                                          map {
# Line 137  sub as_markup { Line 150  sub as_markup {
150                          } @tests )                          } @tests )
151                  . qq|</li></ul>|                  . qq|</li></ul>|
152                  ;                  ;
153                    }
154    
155            $self->add_icon( $1 ) if $html =~ m{class="(passed|failed)"};
156    
157            $running = 0;
158            return $html;
159  }  }
160    
161  1;  1;

Legend:
Removed from v.507  
changed lines
  Added in v.527

  ViewVC Help
Powered by ViewVC 1.1.26