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

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

  ViewVC Help
Powered by ViewVC 1.1.26