r66861 - in /branches/upstream/libtest-html-w3c-perl: ./ current/ current/lib/ current/lib/Test/ current/lib/Test/HTML/ current/t/
periapt-guest at users.alioth.debian.org
periapt-guest at users.alioth.debian.org
Mon Jan 3 19:19:49 UTC 2011
Author: periapt-guest
Date: Mon Jan 3 19:15:14 2011
New Revision: 66861
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66861
Log:
[svn-inject] Installing original source of libtest-html-w3c-perl (0.03)
Added:
branches/upstream/libtest-html-w3c-perl/
branches/upstream/libtest-html-w3c-perl/current/
branches/upstream/libtest-html-w3c-perl/current/Changes
branches/upstream/libtest-html-w3c-perl/current/MANIFEST
branches/upstream/libtest-html-w3c-perl/current/META.yml
branches/upstream/libtest-html-w3c-perl/current/Makefile.PL (with props)
branches/upstream/libtest-html-w3c-perl/current/README
branches/upstream/libtest-html-w3c-perl/current/lib/
branches/upstream/libtest-html-w3c-perl/current/lib/Test/
branches/upstream/libtest-html-w3c-perl/current/lib/Test/HTML/
branches/upstream/libtest-html-w3c-perl/current/lib/Test/HTML/W3C.pm
branches/upstream/libtest-html-w3c-perl/current/t/
branches/upstream/libtest-html-w3c-perl/current/t/98-pod.t (with props)
branches/upstream/libtest-html-w3c-perl/current/t/99-pod-coverage.t (with props)
Added: branches/upstream/libtest-html-w3c-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/Changes?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/Changes (added)
+++ branches/upstream/libtest-html-w3c-perl/current/Changes Mon Jan 3 19:15:14 2011
@@ -1,0 +1,10 @@
+$Id: Changes 4214 2008-05-18 06:43:33Z victor $
+
+0.03 Sunday 18th May 2008
+ - Fixed POD error (CPAN Bug #35002)
+
+0.02 Monday 27th February 2006
+ - Fixed minor POD error
+
+0.01 Monday 27th February 2006
+ - Initial release
Added: branches/upstream/libtest-html-w3c-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/MANIFEST?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/MANIFEST (added)
+++ branches/upstream/libtest-html-w3c-perl/current/MANIFEST Mon Jan 3 19:15:14 2011
@@ -1,0 +1,8 @@
+lib/Test/HTML/W3C.pm
+Changes
+README
+Makefile.PL
+MANIFEST This list of files
+t/98-pod.t
+t/99-pod-coverage.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libtest-html-w3c-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/META.yml?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/META.yml (added)
+++ branches/upstream/libtest-html-w3c-perl/current/META.yml Mon Jan 3 19:15:14 2011
@@ -1,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Test-HTML-W3C
+version: 0.03
+version_from: lib/Test/HTML/W3C.pm
+installdirs: site
+requires:
+ Test::Builder::Module: 0
+ WebService::Validator::HTML::W3C: 0.1
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30
Added: branches/upstream/libtest-html-w3c-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/Makefile.PL?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/Makefile.PL (added)
+++ branches/upstream/libtest-html-w3c-perl/current/Makefile.PL Mon Jan 3 19:15:14 2011
@@ -1,0 +1,19 @@
+#!/usr/bin/perl
+
+use strict;
+use ExtUtils::MakeMaker;
+
+BEGIN {
+ require 5.006_00;
+}
+
+WriteMakefile(
+ NAME => "Test::HTML::W3C",
+ ABSTRACT => "Perform W3C HTML validation testing",
+ AUTHOR => 'victor73 at gmail.com',
+ VERSION_FROM => "lib/Test/HTML/W3C.pm",
+ PREREQ_PM => {
+ "WebService::Validator::HTML::W3C" => 0.1,
+ "Test::Builder::Module" => 0,
+ },
+);
Propchange: branches/upstream/libtest-html-w3c-perl/current/Makefile.PL
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libtest-html-w3c-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/README?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/README (added)
+++ branches/upstream/libtest-html-w3c-perl/current/README Mon Jan 3 19:15:14 2011
@@ -1,0 +1,41 @@
+$Revision: 3768 $
+
+Test::HTML::W3C is a testing module, which uses Test::Builder::Module and is in
+the spirit Test::More. It simply wraps WebService::Validator::HTML::W3C and
+provides some convenient functions to detect HTML/XHTML validation problems
+using services provided by the World Wide Web Consortium (W3C). Please note
+that, as with WebService::Validator::HTML::W3C, this particular module has
+absolutely no connection with the good folks at W3C. Please DO NOT report any
+problems with it to them. In addition, please do not abuse the W3C's validator
+service. If you need to do lots of validation testing, try downloading and
+installing the validator software and modifying the validator uri this module
+uses per the documentation.
+
+PREREQUISITES
+
+WebService::Validator::HTML::W3C
+Test::Builder::Module
+
+INSTALLATION
+
+You should be able to install Test::HTML::W3C in any of the usual ways:
+
+ perl -MCPAN -e 'install Test::HTML::W3C'
+
+or
+
+ perl -MCPANPLUS -e 'install Test::HTML::W3C'
+
+or
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+TESTS
+
+Currently, the only tests provided test for POD correctness and
+coverage. More tests will be supplied later...
+
+For everything else see the POD documentation.
Added: branches/upstream/libtest-html-w3c-perl/current/lib/Test/HTML/W3C.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/lib/Test/HTML/W3C.pm?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/lib/Test/HTML/W3C.pm (added)
+++ branches/upstream/libtest-html-w3c-perl/current/lib/Test/HTML/W3C.pm Mon Jan 3 19:15:14 2011
@@ -1,0 +1,275 @@
+package Test::HTML::W3C;
+
+use strict;
+use vars qw($VERSION @EXPORT);
+$VERSION = "0.03";
+
+=head1 NAME
+
+Test::HTML::W3C - Perform W3C HTML validation testing
+
+=head1 SYNOPSIS
+
+ use Test::HTML::W3C tests => $test_count;
+ # or
+ use Test::HTML::W3C 'show_detail';
+ # or when using both
+ use Test::HTML::W3C tests => $test_count, 'show_detail';
+
+ is_valid_markup($my_html_scalar);
+
+ is_valid_file("/path/to/my/file.html");
+
+ is_valid("http://example.com");
+
+ # Get the underlying WebService:;Validator::W3C::HTML object
+ my $validator = validator();
+
+=head1 DESCRIPTION
+
+The purpose of this module is to provide a wide range of testing
+utilities. Various ways to say "ok" with better diagnostics,
+facilities to skip tests, test future features and compare complicated
+data structures. While you can do almost anything with a simple
+C<ok()> function, it doesn't provide good diagnostic output.
+
+=head1 ABUSE
+
+Please keep in mind that the W3C validation pages and services are
+a shared resource. If you plan to do many many tests, please consider
+using your own installation of the validation programs, and then use
+your local install by modifying the local validtor:
+
+ my $v = validator();
+ $v->validator_uri($my_own_validator);
+
+See the documentation for WebService:;Validator::W3C::HTML and the W3C's
+site at http://validator.w3.org/ for details
+
+=over 4
+
+=cut
+
+use WebService::Validator::HTML::W3C;
+use base qw(Test::Builder::Module);
+ at EXPORT = qw(
+ plan
+ diag_html
+ is_valid_markup
+ is_valid_file
+ is_valid
+ validator
+ );
+
+my $v = WebService::Validator::HTML::W3C->new();
+my $not_checked = 1;
+my $show_detail = 0;
+
+sub import_extra {
+ my ($class, $list) = @_;
+ my @other = ();
+ my $idx = 0;
+ while( $idx <= $#{$list} ) {
+ my $item = $list->[$idx];
+
+ if( defined $item and $item eq 'show_detail' ) {
+ $show_detail = 1;
+ $v = WebService::Validator::HTML::W3C->new(detailed => 1);
+ } else {
+ push @other, $item;
+ }
+ $idx++;
+ }
+ @$list = @other;
+}
+
+=item validator();
+
+B<Description:> Returns the underlying WebService::Validator::HTML::W3C object
+
+B<Parameters:> None.
+
+B<Returns:> $validator
+
+=cut
+
+sub validator {
+ return $v;
+}
+
+
+=item plan();
+
+B<Description:> Returns the underlying WebService::Validator::HTML::W3C object
+
+B<Parameters:> None.
+
+B<Returns:> $validator
+
+=cut
+
+sub plan {
+ __PACKAGE__->builder->plan(@_);
+}
+
+sub _check_plan {
+ $not_checked = 0;
+ if (! __PACKAGE__->builder->has_plan()) {
+ plan("no_plan");
+ }
+}
+
+=item is_valid_markup($markup[, $name]);
+
+B<Description:> is_valid_markup tests whether the text in the provided scalar
+value correctly validates according to the W3C specifications. This is useful
+if you have markup stored in a scalar that you wish to test that you might get
+from using LWP or WWW::Mechanize for example...
+
+B<Parameters:> $markup, a scalar containing the data to test, $name, an
+optional descriptive test name.
+
+B<Returns:> None.
+
+=cut
+
+sub is_valid_markup {
+ _check_plan() if $not_checked;
+ my ($markup, $message) = @_;
+ if ($v->validate_markup($markup)) {
+ _result($v, $message);
+ } else {
+ _validator_err($v, "markup");
+ }
+}
+
+=item is_valid_file($path[, $name]);
+
+B<Description:> is_valid_file works the same way as is_valid_markup, except that
+you can specify the text to validate with the path to a filename. This is useful
+if you have pregenerated all your HTML files locally, and now wish to test them.
+
+B<Parameters:> $path, a scalar, $name, an optional descriptive test name.
+
+B<Returns:> None.
+
+=cut
+
+sub is_valid_file {
+ my ($file, $message) = @_;
+ _check_plan() if $not_checked;
+ if ($v->validate_file($file)) {
+ _result($v, $message);
+ } else {
+ _validator_err($v, "file");
+ }
+}
+
+
+=item is_valid($url[, $name]);
+
+B<Description:> is_valid, again, works very similarly to the is_valid_file and
+is_valid_file, except you specify a document that is already online with its
+URL. This can be useful if you wish to periodically test a website or webpage
+that dynamically changes over time for example, like a blog or a wiki, without
+first saving the html to a file using your browswer, or a utility such as wget.
+
+B<Parameters:> $url, a scalar, $name, an optional descriptive test name.
+
+B<Returns:> None.
+
+=cut
+
+sub is_valid {
+ my ($uri, $message) = @_;
+ _check_plan() if $not_checked;
+ if ($v->validate($uri)) {
+ _result($v, $message);
+ } else {
+ _validator_err($v, "URI");
+ }
+}
+
+sub _validator_err {
+ my ($validator, $type) = @_;
+ __PACKAGE__->builder->ok(0, "Failed to validate $type.");
+ __PACKAGE__->builder->diag($v->validator_error());
+}
+
+sub _result {
+ my ($validator, $message) = @_;
+ if ($validator->is_valid()) {
+ __PACKAGE__->builder->ok(1, $message);
+ } else {
+ my $num = $validator->num_errors();
+ my $plurality = ($num == 1) ? "error" : "errors";
+ __PACKAGE__->builder->ok(0, $message . " ($num $plurality).");
+ }
+}
+
+
+=item diag_html($url);
+
+B<Description:> If you want to display the actual errors reported by
+the service for a particular test, you can use the diag_html function.
+Please note that you must have imported 'show_detail' for this to
+work properly.
+
+ use Test::HTML::W3C 'show_detail';
+
+ is_valid_markup("<html></html">, "My simple test") or diag_html();
+
+B<Parameters:> $url, a scalar.
+
+B<Returns:> None.
+
+=cut
+
+sub diag_html {
+ my $tb = __PACKAGE__->builder();
+ if ($show_detail) {
+ my @errs = $v->errors();
+ my $e;
+ foreach my $error ( @{$v->errors()} ) {
+ $e .= sprintf("%s at line %d\n", $error->msg, $error->line);
+ }
+ $tb->diag($e);
+ } else {
+ $tb->diag("You need to import 'show_detail' in order to call diag_html\n");
+ }
+}
+
+
+1;
+
+__END__
+
+=back
+
+=head1 SEE ALSO
+
+L<Test::Builder::Module> for creating your own testing modules.
+
+L<Test::More> for another popular testing framework, also based on
+Test::Builder
+
+L<Test::Harness> for detils about how test results are interpreted.
+
+=head1 AUTHORS
+
+Victor E<lt>victor73 at gmail.comE<gt> with inspiration
+from the authors of the Test::More and WebService::Validator::W3C:HTML
+modules.
+
+=head1 BUGS
+
+See F<http://rt.cpan.org> to report and view bugs.
+
+=head1 COPYRIGHT
+
+Copyright 2006 by Victor E<lt>victor73 at gmail.comE<gt>.
+
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+See F<http://www.perl.com/perl/misc/Artistic.html>
Added: branches/upstream/libtest-html-w3c-perl/current/t/98-pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/t/98-pod.t?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/t/98-pod.t (added)
+++ branches/upstream/libtest-html-w3c-perl/current/t/98-pod.t Mon Jan 3 19:15:14 2011
@@ -1,0 +1,12 @@
+#!/usr/local/bin/perl
+
+# $Id: 97-pod.t 7575 2006-02-23 00:19:02Z vfelix $
+
+use strict;
+use Test::More;
+use FindBin qw($Bin);
+eval "use Test::Pod 1.20";
+plan skip_all => "Test::Pod 1.20 required for testing POD $@" if $@;
+
+my @poddirs = ( "$Bin/../lib" );
+all_pod_files_ok( all_pod_files( @poddirs ) );
Propchange: branches/upstream/libtest-html-w3c-perl/current/t/98-pod.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libtest-html-w3c-perl/current/t/99-pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-html-w3c-perl/current/t/99-pod-coverage.t?rev=66861&op=file
==============================================================================
--- branches/upstream/libtest-html-w3c-perl/current/t/99-pod-coverage.t (added)
+++ branches/upstream/libtest-html-w3c-perl/current/t/99-pod-coverage.t Mon Jan 3 19:15:14 2011
@@ -1,0 +1,11 @@
+#!/usr/local/bin/perl
+
+use strict;
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+
+plan tests=>1;
+pod_coverage_ok( "Test::HTML::W3C",
+ { also_private => [ qr/^import.+$/ ], }, "Test::W3C pod coverage",
+);
Propchange: branches/upstream/libtest-html-w3c-perl/current/t/99-pod-coverage.t
------------------------------------------------------------------------------
svn:executable =
More information about the Pkg-perl-cvs-commits
mailing list