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 |
|
|
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 |
} |
} |
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 |
|
|
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| |
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> ← | |
qq|<a href="?test=$_"><tt>$_</tt></a> ← | |
139 |
. |
. |
140 |
join(' ', |
join(' ', |
141 |
map { |
map { |
150 |
} @tests ) |
} @tests ) |
151 |
. qq|</li></ul>| |
. qq|</li></ul>| |
152 |
; |
; |
153 |
|
} |
154 |
|
|
155 |
|
$running = 0; |
156 |
|
return $html; |
157 |
} |
} |
158 |
|
|
159 |
1; |
1; |