r22856 - in /trunk/libtest-tap-htmlmatrix-perl: ./ debian/ lib/Test/TAP/ lib/Test/TAP/HTMLMatrix/ lib/Test/TAP/Model/ lib/Test/TAP/Model/File/ t/
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Sun Jul 6 12:26:54 UTC 2008
Author: gregoa
Date: Sun Jul 6 12:26:53 2008
New Revision: 22856
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=22856
Log:
New upstream release.
Added:
trunk/libtest-tap-htmlmatrix-perl/Changes
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/Changes
trunk/libtest-tap-htmlmatrix-perl/README
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/README
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/detailed_view.html
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/detailed_view.html
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/summary_view.html
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/lib/Test/TAP/HTMLMatrix/summary_view.html
trunk/libtest-tap-htmlmatrix-perl/t/dummy.t
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/t/dummy.t
trunk/libtest-tap-htmlmatrix-perl/t/inline_css.t
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/t/inline_css.t
trunk/libtest-tap-htmlmatrix-perl/t/no_plan.t
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/t/no_plan.t
trunk/libtest-tap-htmlmatrix-perl/t/pod-coverage.t
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/t/pod-coverage.t
trunk/libtest-tap-htmlmatrix-perl/t/pod.t
- copied unchanged from r22855, branches/upstream/libtest-tap-htmlmatrix-perl/current/t/pod.t
Removed:
trunk/libtest-tap-htmlmatrix-perl/SIGNATURE
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/template.html
trunk/libtest-tap-htmlmatrix-perl/t/00_dist.t
Modified:
trunk/libtest-tap-htmlmatrix-perl/Build.PL
trunk/libtest-tap-htmlmatrix-perl/MANIFEST
trunk/libtest-tap-htmlmatrix-perl/META.yml
trunk/libtest-tap-htmlmatrix-perl/Makefile.PL
trunk/libtest-tap-htmlmatrix-perl/debian/changelog
trunk/libtest-tap-htmlmatrix-perl/example.pl
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix.pm
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/htmlmatrix.css
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Colorful.pm
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/File/Visual.pm
trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Visual.pm
trunk/libtest-tap-htmlmatrix-perl/t/basic.t
trunk/libtest-tap-htmlmatrix-perl/t/file_visual.t
trunk/libtest-tap-htmlmatrix-perl/t/paths.t
trunk/libtest-tap-htmlmatrix-perl/t/templ_output.t
Modified: trunk/libtest-tap-htmlmatrix-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/Build.PL?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/Build.PL (original)
+++ trunk/libtest-tap-htmlmatrix-perl/Build.PL Sun Jul 6 12:26:53 2008
@@ -9,8 +9,9 @@
license => 'perl',
requires => {
'perl' => '>= 5.008',
- 'Test::TAP::Model' => '>= 0.03',
+ 'Test::TAP::Model' => '>= 0.08',
'Petal' => 0,
+ 'Petal::Utils' => 0,
'URI::file' => 0,
},
build_requires => {
Modified: trunk/libtest-tap-htmlmatrix-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/MANIFEST?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/MANIFEST (original)
+++ trunk/libtest-tap-htmlmatrix-perl/MANIFEST Sun Jul 6 12:26:53 2008
@@ -1,22 +1,28 @@
Build.PL
+Changes
example.pl
lib/Test/TAP/HTMLMatrix.pm
+lib/Test/TAP/HTMLMatrix/detailed_view.html
lib/Test/TAP/HTMLMatrix/htmlmatrix.css
-lib/Test/TAP/HTMLMatrix/template.html
+lib/Test/TAP/HTMLMatrix/summary_view.html
lib/Test/TAP/Model/Colorful.pm
lib/Test/TAP/Model/File/Visual.pm
lib/Test/TAP/Model/Subtest/Visual.pm
lib/Test/TAP/Model/Visual.pm
+Makefile.PL
MANIFEST This list of files
-t/00_dist.t
+META.yml
+README
t/basic.t
t/colorful.t
+t/dummy.t
t/file_visual.t
+t/inline_css.t
t/model_visual.t
+t/no_plan.t
t/paths.t
+t/pod-coverage.t
+t/pod.t
t/subtest_visual.t
t/templ_output.t
t/uri.t
-META.yml
-Makefile.PL
-SIGNATURE Added here by Module::Build
Modified: trunk/libtest-tap-htmlmatrix-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/META.yml?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/META.yml (original)
+++ trunk/libtest-tap-htmlmatrix-perl/META.yml Sun Jul 6 12:26:53 2008
@@ -1,28 +1,16 @@
----
-name: Test-TAP-HTMLMatrix
-version: 0.04
-author: ~
-abstract: |-
- Creates colorful matrix of L<Test::Harness>
- friendly test run results using L<Test::TAP::Model>.
-license: perl
-requires:
- Petal: 0
- Test::TAP::Model: >= 0.03
- URI::file: 0
- perl: >= 5.008
-build_requires:
- Test::More: 0
-provides:
- Test::TAP::HTMLMatrix:
- file: lib/Test/TAP/HTMLMatrix.pm
- version: 0.04
- Test::TAP::Model::Colorful:
- file: lib/Test/TAP/Model/Colorful.pm
- Test::TAP::Model::File::Visual:
- file: lib/Test/TAP/Model/File/Visual.pm
- Test::TAP::Model::Subtest::Visual:
- file: lib/Test/TAP/Model/Subtest/Visual.pm
- Test::TAP::Model::Visual:
- file: lib/Test/TAP/Model/Visual.pm
-generated_by: Module::Build version 0.2609
+--- #YAML:1.0
+name: Test-TAP-HTMLMatrix
+version: 0.09
+abstract: ~
+license: ~
+generated_by: ExtUtils::MakeMaker version 6.32
+distribution_type: module
+requires:
+ Petal: 0
+ Petal::Utils: 0
+ Test::More: 0
+ Test::TAP::Model: >= 0.08
+ URI::file: 0
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Modified: trunk/libtest-tap-htmlmatrix-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/Makefile.PL?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/Makefile.PL (original)
+++ trunk/libtest-tap-htmlmatrix-perl/Makefile.PL Sun Jul 6 12:26:53 2008
@@ -2,15 +2,17 @@
use ExtUtils::MakeMaker;
WriteMakefile
(
+ 'PL_FILES' => {},
+ 'INSTALLDIRS' => 'site',
'NAME' => 'Test::TAP::HTMLMatrix',
+ 'EXE_FILES' => [],
'VERSION_FROM' => 'lib/Test/TAP/HTMLMatrix.pm',
'PREREQ_PM' => {
- 'Petal' => '0',
- 'Test::More' => '0',
- 'Test::TAP::Model' => '>= 0.03',
- 'URI::file' => '0'
- },
- 'INSTALLDIRS' => 'site',
- 'PL_FILES' => {}
+ 'Test::More' => 0,
+ 'URI::file' => 0,
+ 'Petal' => 0,
+ 'Petal::Utils' => 0,
+ 'Test::TAP::Model' => '>= 0.08'
+ }
)
;
Modified: trunk/libtest-tap-htmlmatrix-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/debian/changelog?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/debian/changelog (original)
+++ trunk/libtest-tap-htmlmatrix-perl/debian/changelog Sun Jul 6 12:26:53 2008
@@ -1,4 +1,4 @@
-libtest-tap-htmlmatrix-perl (0.04-2) UNRELEASED; urgency=low
+libtest-tap-htmlmatrix-perl (0.09-1) UNRELEASED; urgency=low
* Take over for the Debian Perl Group with maintainer's permission
(http://lists.debian.org/debian-perl/2008/06/msg00039.html)
@@ -10,6 +10,8 @@
to Uploaders.
* Add debian/watch.
+ * New upstream release.
+
-- gregor herrmann <gregoa at debian.org> Sun, 15 Jun 2008 17:40:40 +0200
libtest-tap-htmlmatrix-perl (0.04-1) unstable; urgency=low
Modified: trunk/libtest-tap-htmlmatrix-perl/example.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/example.pl?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/example.pl (original)
+++ trunk/libtest-tap-htmlmatrix-perl/example.pl Sun Jul 6 12:26:53 2008
@@ -1,17 +1,31 @@
#!/usr/bin/perl
+
+use strict;
+use warnings;
use Test::TAP::HTMLMatrix;
use Test::TAP::Model::Visual;
+use Test::TAP::Model::Consolidated;
-my $model = Test::TAP::Model::Visual->new_with_tests(glob("t/*.t"));
+# make a successful test run
+my $model_ok = Test::TAP::Model::Visual->new_with_tests(glob("t/*.t"));
+$model_ok->desc_string("real run");
-open STDOUT, ">", "example.html"; #"|xmllint --noblanks -> example.html" or die "couldn't pipe to xmllint";
+# make a dummy run with some failures
+my $model_failing = do { local $ENV{TEST_FAIL_RANDOMLY} = 1; Test::TAP::Model::Visual->new_with_tests(glob("t/*.t")) };
+$model_failing->desc_string("dummy failures");
-my $v = Test::TAP::HTMLMatrix->new($model);
+my $v = Test::TAP::HTMLMatrix->new(Test::TAP::Model::Consolidated->new($model_ok, $model_failing));
+# control the HTML output
$v->has_inline_css(1);
+#$v->no_javascript(1);
-print "$v";
+# this is the most popular view:
+print $v->detail_html;
-print STDERR "open example.html\n";
+# you can also get a more compact summary:
+#print $v->summary_html;
+# or a directory with both files and some css
+# $v->output_dir("example_html");
Modified: trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix.pm?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix.pm (original)
+++ trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix.pm Sun Jul 6 12:26:53 2008
@@ -1,73 +1,122 @@
#!/usr/bin/perl
package Test::TAP::HTMLMatrix;
-use fields qw/model extra petal has_inline_css/;
use strict;
use warnings;
use Test::TAP::Model::Visual;
+use Test::TAP::Model::Consolidated;
use Petal;
+use Petal::Utils qw/:logic/;
use Carp qw/croak/;
use File::Spec;
+use File::Path;
use URI::file;
use overload '""' => "html";
-our $VERSION = "0.04";
+our $VERSION = "0.09";
sub new {
- my $pkg = shift;
-
- my $model = shift || croak "must supply a model to graph";
-
- my __PACKAGE__ $self = $pkg->fields::new;
-
- my $ext = shift;
- my $petal = shift || Petal->new(
- file => File::Spec->abs2rel($self->template_file), # damn petal requires rel path
+ my ( $pkg, @models ) = @_;
+
+ my $ext = pop @models unless eval { $models[-1]->isa("Test::TAP::Model") };
+
+ @models || croak "must supply a model to graph";
+
+ my $self = bless {}, $pkg;
+
+ $self->model(@models);
+ $self->extra($ext);
+
+ $self;
+}
+
+sub title { "TAP Matrix - " . gmtime() . " GMT" }
+
+sub tests {
+ my $self = shift;
+ [ sort { $a->name cmp $b->name } $self->model->test_files ];
+}
+
+sub model {
+ my $self = shift;
+ if (@_) {
+ $self->{model} = $_[0]->isa("Test::TAP::Model::Consolidated")
+ ? shift
+ : Test::TAP::Model::Consolidated->new(@_);
+ }
+
+ $self->{model};
+}
+
+sub extra {
+ my $self = shift;
+ $self->{extra} = shift if @_;
+ $self->{extra};
+}
+
+sub petal {
+ my $self = shift;
+ my $file = shift;
+
+ Petal->new(
+ file => File::Spec->abs2rel($file), # damn petal requires rel path
input => "XHTML",
output => "XHTML",
encode_charset => "utf8",
decode_charset => "utf8",
);
-
- $self->model($model);
- $self->extra($ext);
- $self->petal($petal);
-
- $self;
-}
-
-sub title { "TAP Matrix - " . gmtime() . " GMT" }
-
-sub tests {
- my $self = shift;
- [ sort { $a->name cmp $b->name } $self->model->test_files ];
-}
-
-sub model {
- my __PACKAGE__ $self = shift;
- $self->{model} = shift if @_;
- $self->{model};
-}
-
-sub extra {
- my __PACKAGE__ $self = shift;
- $self->{extra} = shift if @_;
- $self->{extra};
-}
-
-sub petal {
- my __PACKAGE__ $self = shift;
- $self->{petal} = shift if @_;
- $self->{petal};
}
sub html {
- my __PACKAGE__ $self = shift;
- $self->{petal}->process(page => $self);
+ my $self = shift;
+ $self->detail_html;
+}
+
+sub detail_html {
+ my $self = shift;
+ $self->template_to_html($self->detail_template);
+}
+
+sub summary_html {
+ my $self = shift;
+ $self->template_to_html($self->summary_template);
+}
+
+sub output_dir {
+ my $self = shift;
+ my $dir = shift || die "You need to specify a directory";
+
+ mkpath $dir or die "can't create directory '$dir': $!" unless -e $dir;
+
+ local $self->{_css_uri} = "htmlmatrix.css";
+
+ my %outputs = (
+ "summary.html" => $self->summary_html,
+ "detail.html" => $self->detail_html,
+ ( $self->has_inline_css ? () : "htmlmatrix.css" => $self->_slurp_css ),
+ );
+
+ foreach my $file ( keys %outputs ) {
+ open my $fh, ">", File::Spec->catfile( $dir, $file ) or die "can't open '$file' for writing: $!";
+ print $fh $outputs{$file};
+ close $fh or die "can't close '$file'";
+ }
+}
+
+sub template_to_html {
+ my $self = shift;
+ my $path = shift;
+ $self->process_petal($self->petal($path));
+}
+
+sub process_petal {
+ my $self = shift;
+ my $petal = shift;
+ $petal->process(page => $self);
}
sub _find_in_INC {
@@ -87,9 +136,14 @@
$self->_find_in_INC(File::Spec->catfile(split("::", __PACKAGE__), shift));
}
-sub template_file {
- my $self = shift;
- $self->_find_in_my_INC("template.html");
+sub detail_template {
+ my $self = shift;
+ $self->_find_in_my_INC("detailed_view.html");
+}
+
+sub summary_template {
+ my $self = shift;
+ $self->_find_in_my_INC("summary_view.html");
}
sub css_file {
@@ -99,13 +153,24 @@
sub css_uri {
my $self = shift;
- URI::file->new($self->css_file);
+ $self->{_css_uri} || URI::file->new($self->css_file);
}
sub has_inline_css {
my $self = shift;
$self->{has_inline_css} = shift if @_;
$self->{has_inline_css};
+}
+
+sub no_javascript {
+ my $self = shift;
+ $self->{no_javascript} = shift if @_;
+ $self->{no_javascript};
+}
+
+sub has_javascript {
+ my $self = shift;
+ !$self->no_javascript;
}
sub _slurp_css {
@@ -152,17 +217,21 @@
=over 4
-=item new ($model, $?extra, $?petal)
-
-$model is the L<Test::TAP::Model> object to extract results from, and the
-optional $?extra is a string to put in <pre></pre> at the top.
-
-$petal is an optional templater object. If you are not happy with the default
-template, you can use this. Read the source to see how it's processed.
+=item new (@models, $?extra)
+
+ at model is at least one L<Test::TAP::Model> object (or exactly one
+L<Test::TAP::Model::Consolidated>) to extract results from, and the optional
+$?extra is a string to put in <pre></pre> at the top.
=item html
-Returns an HTML string.
+Deprecated method - aliases to C<detail_html>.
+
+=item detail_html
+
+=item summary_html
+
+Returns an HTML string for the corresponding template.
This is also the method implementing stringification.
@@ -184,14 +253,16 @@
A sorted array ref, resulting from $self->model->test_files;
-=item template_file
+=item detail_template
+
+=item summary_template
=item css_file
These return the full path to the L<Petal> template and the CSS stylesheet it
uses.
-Note that these are taken from @INC. If you put F<template.html> under
+Note that these are taken from @INC. If you put F<detailed_view.html> under
C< catfile(qw/Test TAP HTMLMatrix/) > somewhere in your @INC, it should find it
like you'd expect.
@@ -206,12 +277,36 @@
This accessor controls whether inline CSS will be generated instead of C<<
<link> >> style stylesheet refs.
+=item has_javascript $?new_value
+
+This accessor controls whether to generate a javascript enhanced or javascript
+free version of the reports.
+
=item inline_css
Returns the contents of C<css_file> fudged slightly to work inside C<< <style>
>> tags.
+=item template_to_html $path
+
+Processes the said template using C<process_petal>.
+
+=item process_petal $petal
+
+Takes a petal object and processes it.
+
+=item no_javascript
+
+A predicate method used in the templates for checking if no javascript is
+desired. The opposite of C<has_javascript>.
+
=back
+
+=head1 VERSION CONTROL
+
+This module is maintained using Darcs. You can get the latest version from
+L<http://nothingmuch.woobling.org/Test-TAP-HTMLMatrix/>, and use C<darcs send>
+to commit changes.
=head1 AUTHORS
@@ -246,7 +341,11 @@
=item *
-Autrijs Tang <autrijus at autrjius.org> AUTRIJUS
+Audrey Tang <cpan at audreyt.org> AUDREYT
+
+=item *
+
+Casey West <casey at geeknest.com> CWEST
=item *
Modified: trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/htmlmatrix.css
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/htmlmatrix.css?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/htmlmatrix.css (original)
+++ trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/HTMLMatrix/htmlmatrix.css Sun Jul 6 12:26:53 2008
@@ -4,7 +4,7 @@
background-color: #EFEFEF;
}
-a { color: #000066; text-decoration: none; font-style: italic; }
+a { color: #000066; text-decoration: none; }
/* has to do with div style tooltips: div { display: none; } */
@@ -23,14 +23,18 @@
border: 1px solid #444444;
font-weight: bold;
font-size: 1em;
- color: black
+ color: black;
text-align: center;
- vertical-algin: middle;
+ vertical-align: baseline;
background-color: #efefef;
}
.td {
padding: 0.2em;
+}
+
+.exp {
+ display: block;
}
.x {
@@ -40,6 +44,7 @@
overflow: hidden;
border: 1px solid #444444;
}
+
.x a { display: block; text-decoration: none;}
/* again, div style tooltips: .x a div { display: none; font-weight: bold; color: #336699; font-style: none;}
.x a:visited div { display: none }
@@ -64,3 +69,26 @@
.u { background-color: #ffdd20; color: white; }
.t { background-color: #007f00; color: white; }
.nottest { background-color: #7f7f7f; color: white ; }
+
+.min {
+ font-size: 70%;
+ vertical-align: top;
+ padding-top: .9em;
+ color: #333;
+}
+
+.min a:hover {
+ text-decoration: none;
+ color: #e33;
+}
+
+tbody, tr { border: none }
+
+.collapsed_diff, .expanded_diff { background-color: #888; border: 1px solid #444444 }
+
+.expanded_normal, .collapsed_diff { display: none }
+.collapsed_normal, .expanded_diff { display: table-row-group }
+
+.model_desc { font-size: 85%; padding-left: 1.2em }
+
+.misc_text { font-size: 80%; }
Modified: trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Colorful.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Colorful.pm?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Colorful.pm (original)
+++ trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Colorful.pm Sun Jul 6 12:26:53 2008
@@ -4,6 +4,15 @@
use strict;
use warnings;
+
+use Test::TAP::Model;
+use Test::TAP::Model::File;
+
+# yucky mixin behavior
+BEGIN {
+ push @Test::TAP::Model::ISA, __PACKAGE__;
+ push @Test::TAP::Model::File::ISA, __PACKAGE__;
+}
sub color {
my $self = shift;
Modified: trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/File/Visual.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/File/Visual.pm?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/File/Visual.pm (original)
+++ trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/File/Visual.pm Sun Jul 6 12:26:53 2008
@@ -1,15 +1,38 @@
#!/usr/bin/perl
package Test::TAP::Model::File::Visual;
-use base qw/Test::TAP::Model::File Test::TAP::Model::Colorful/;
+use base qw/Test::TAP::Model::File/;
use strict;
use warnings;
+use Test::TAP::Model::Colorful;
use Test::TAP::Model::Subtest::Visual;
use URI::file;
sub subtest_class { "Test::TAP::Model::Subtest::Visual" }
+
+sub desc_string {
+ my $self = shift;
+ $self->{_desc_string} = shift if @_;
+ $self->{_desc_string} ||= "";
+}
+
+sub cases {
+ my $self = shift;
+ return $self->SUPER::cases(@_) unless wantarray;
+
+ my @ret = $self->SUPER::cases(@_);
+ return @ret if @ret;
+
+ # if there are no tests, return a stub that represents the whole file
+ return $self->subtest_class->new({
+ type => "test",
+ ok => $self->ok,
+ skip => $self->skipped,
+ line => "stub"
+ });
+}
sub str_status {
my $self = shift;
@@ -66,6 +89,10 @@
=over 4
+=item cases
+
+An overridden version of L<Test::TAP::Model::File/cases> which will return a single stub case if the case list is actually empty.
+
=item str_status
A string, "OK" or "FAILED"
@@ -88,6 +115,11 @@
This method overrides L<Test::TAP::Model::File/subtest_class> to return
L<Test::TAP::Model::Subtest::Visual>.
+=item desc_string ?$new_value
+
+A short descriptive string used to distinguish this file from others in the
+various report views.
+
=back
=cut
Modified: trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Visual.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Visual.pm?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Visual.pm (original)
+++ trunk/libtest-tap-htmlmatrix-perl/lib/Test/TAP/Model/Visual.pm Sun Jul 6 12:26:53 2008
@@ -1,22 +1,26 @@
#!/usr/bin/perl
package Test::TAP::Model::Visual;
-use base qw/Test::TAP::Model Test::TAP::Model::Colorful/;
+use base qw/Test::TAP::Model/;
use strict;
use warnings;
+use Test::TAP::Model::Colorful;
use Test::TAP::Model::File::Visual;
sub file_class { "Test::TAP::Model::File::Visual" }
-sub summary {
+sub get_test_files {
my $self = shift;
- $self->{_summar} ||=
- sprintf "%d test cases: %d ok, %d failed, %d todo, "
- ."%d skipped and %d unexpectedly succeeded",
- map { my $m = "total_$_"; $self->$m }
- qw/seen passed failed todo skipped unexpectedly_succeeded/;
+ my $str = $self->desc_string;
+ map { $_->desc_string($str); $_ } $self->SUPER::get_test_files(@_);
+}
+
+sub desc_string {
+ my $self = shift;
+ $self->{_desc_string} = shift if @_;
+ $self->{_desc_string} ||= "";
}
__PACKAGE__
@@ -52,6 +56,16 @@
A nice little textual summary about the result of the entire test run.
+=item desc_string
+
+A short descriptive string used to distinguish this model from others in the
+various consolidated reports.
+
+=item get_test_files
+
+An overridden version of get_test_files which sets C<desc_string> on the files
+based on the one from $self.
+
=back
=cut
Modified: trunk/libtest-tap-htmlmatrix-perl/t/basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/t/basic.t?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/t/basic.t (original)
+++ trunk/libtest-tap-htmlmatrix-perl/t/basic.t Sun Jul 6 12:26:53 2008
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 5;
my $m;
@@ -17,7 +17,6 @@
can_ok($v, "html");
can_ok($v, "petal");
-isa_ok($v->petal, "Petal");
can_ok($v, "extra");
Modified: trunk/libtest-tap-htmlmatrix-perl/t/file_visual.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/t/file_visual.t?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/t/file_visual.t (original)
+++ trunk/libtest-tap-htmlmatrix-perl/t/file_visual.t Sun Jul 6 12:26:53 2008
@@ -4,6 +4,7 @@
use warnings;
use Test::More tests => 15;
+use Test::Harness::Results;
my $m;
@@ -20,36 +21,35 @@
can_ok($m, "str_status");
-my $f= $m->new(my $r = {
+my $f = $m->new(my $r = {
file => "foo",
});
-$r->{results}{max} = 1;
-$r->{results}{passing} = 1;
-$r->{results}{seen} = 1;
+my $results = Test::Harness::Results->new();
+$r->{results} = $results;
+$results->inc_max();
+$results->set_passing( 1 );
+$results->inc_seen();
is($f->str_status, "OK", "seen + ok = OK");
-$r->{results}{max} = 2;
+$results->inc_max();
is($f->str_status, "FAILED", "seen != planned = FAILED");
-$r->{results}{max} = 1;
-$r->{results}{seen} = 0;
+$r->{results} = $results = Test::Harness::Results->new();
+$results->inc_max();
is($f->str_status, "FAILED", "no tests + ok = FAILED");
-$r->{results}{passing} = 0;
-$r->{results}{seen} = 1;
+$results->inc_seen();
is($f->str_status, "FAILED", "seen + fail = FAILED");
-$r->{results}{passing} = 1;
+$results->set_passing( 1 );
$r->{events}[0]{type} = "bailout";
is($f->str_status, "BAILED OUT", "seen + ok + bailout = BAILED OUT");
-$r->{results}{passing} = 1;
-$r->{results}{skip_all} = "foo";
+$results->set_skip_all( "foo" );
$r->{events} = [];
is($f->str_status, "SKIPPED", "seen + ok + skip_all = SKIPPED");
-$r->{results}{seen} = 0;
-$r->{results}{skip_all} = "foo";
+$r->{results} = $results = Test::Harness::Results->new();
+$results->set_skip_all( "foo" );
is($f->str_status, "SKIPPED", "no seen + ok + skip_all = SKIPPED");
-
Modified: trunk/libtest-tap-htmlmatrix-perl/t/paths.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/t/paths.t?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/t/paths.t (original)
+++ trunk/libtest-tap-htmlmatrix-perl/t/paths.t Sun Jul 6 12:26:53 2008
@@ -3,18 +3,24 @@
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More tests => 10;
use File::Spec;
my $m;
BEGIN { use_ok($m = "Test::TAP::HTMLMatrix") }
-my $template = $m->template_file;
+my $detail = $m->detail_template;
-ok(-e $template, "template file exists");
-like($template, qr/template\.html$/, "name looks OK");
-ok(File::Spec->file_name_is_absolute($template), "abs path");
+ok(-e $detail, "detail file exists");
+like($detail, qr/detailed_view\.html$/, "name looks OK");
+ok(File::Spec->file_name_is_absolute($detail), "abs path");
+
+my $summary = $m->summary_template;
+
+ok(-e $summary, "summary file exists");
+like($summary, qr/summary_view\.html$/, "name looks OK");
+ok(File::Spec->file_name_is_absolute($summary), "abs path");
my $css = $m->css_file;
Modified: trunk/libtest-tap-htmlmatrix-perl/t/templ_output.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-tap-htmlmatrix-perl/t/templ_output.t?rev=22856&op=diff
==============================================================================
--- trunk/libtest-tap-htmlmatrix-perl/t/templ_output.t (original)
+++ trunk/libtest-tap-htmlmatrix-perl/t/templ_output.t Sun Jul 6 12:26:53 2008
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 30;
use Test::TAP::Model::Visual;
@@ -16,7 +16,7 @@
my $s = Test::TAP::Model::Visual->new;
my $f = $s->start_file("foo");
-eval { $f->{results} = { $s->analyze("foo", [split /\n/, <<TAP]) } };
+eval { $f->{results} = $s->analyze("foo", [split /\n/, <<TAP]) };
1..6
ok 1 foo
not ok 2 bar
@@ -28,22 +28,30 @@
isa_ok(my $t = $m->new($s, "extra"), $m);
-my $html = "$t";
+for my $no_js (1, 0) {
+ $t->no_javascript($no_js);
+ my $detail_html = $t->detail_html;
-like($html, qr{<html.*/html>}s, "has <html> tags");
+ like($detail_html, qr{<html.*/html>}s, "detail view has <html> tags");
-like($html, qr/ok 1 foo/, "contains subtest 1 line");
-like($html, qr/not ok 2 bar/, "subtest 2 line");
-like($html, qr/ok 3 gorch/, "subtest 3 line");
+ like($detail_html, qr/ok 1 foo/, "contains subtest 1 line");
+ like($detail_html, qr/not ok 2 bar/, "subtest 2 line");
+ like($detail_html, qr/ok 3 gorch/, "subtest 3 line");
-like($html, qr/66.6\d%/, "contains percentage");
+ like($detail_html, qr/66\.67%/, "contains percentage");
-like($html, qr/BAILED OUT/, "something bailed out in there");
+ like($detail_html, qr/BAILED OUT/, "something bailed out in there");
-like($html, qr/4\s+ok/is, "ok summary");
-like($html, qr/2\s+failed/is, "contains fail summary");
-like($html, qr/1\s+skipped/is, "contains skip summary");
-like($html, qr/2\s+todo/is, "contains skip summary");
-like($html, qr/1\s+unexpectedly\s+succeeded/is, "contains skip summary");
+ like($detail_html, qr/4\s+ok/is, "ok summary");
+ like($detail_html, qr/2\s+failed/is, "contains fail summary");
+ like($detail_html, qr/1\s+skipped/is, "contains skip summary");
+ like($detail_html, qr/2\s+todo/is, "contains skip summary");
+ like($detail_html, qr/1\s+unexpectedly\s+succeeded/is, "contains skip summary");
-like($html, qr/6/, "the number 6 is mentioned, that was our plan");
+ like($detail_html, qr/6/, "the number 6 is mentioned, that was our plan");
+
+ my $summary_html = $t->summary_html;
+ like($summary_html, qr{<html.*/html>}s, "summary has <html> tags");
+ like($summary_html, qr/66\.67%/, "contains percentage");
+}
+
More information about the Pkg-perl-cvs-commits
mailing list