r44552 - in /trunk/libtest-xml-simple-perl: Changes META.yml Makefile.PL README debian/changelog debian/control lib/Test/XML/Simple.pm t/03valid.t t/04node.t t/05is.t t/06like.t t/07deeply.t t/08attr.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Mon Sep 21 19:05:41 UTC 2009
Author: jawnsy-guest
Date: Mon Sep 21 19:05:34 2009
New Revision: 44552
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=44552
Log:
Switch to Test::Builder::Tester instead of Test::Tester
Modified:
trunk/libtest-xml-simple-perl/Changes
trunk/libtest-xml-simple-perl/META.yml
trunk/libtest-xml-simple-perl/Makefile.PL
trunk/libtest-xml-simple-perl/README
trunk/libtest-xml-simple-perl/debian/changelog
trunk/libtest-xml-simple-perl/debian/control
trunk/libtest-xml-simple-perl/lib/Test/XML/Simple.pm
trunk/libtest-xml-simple-perl/t/03valid.t
trunk/libtest-xml-simple-perl/t/04node.t
trunk/libtest-xml-simple-perl/t/05is.t
trunk/libtest-xml-simple-perl/t/06like.t
trunk/libtest-xml-simple-perl/t/07deeply.t
trunk/libtest-xml-simple-perl/t/08attr.t
Modified: trunk/libtest-xml-simple-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/Changes?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/Changes (original)
+++ trunk/libtest-xml-simple-perl/Changes Mon Sep 21 19:05:34 2009
@@ -1,4 +1,10 @@
Revision history for Perl extension Test::XML::Simple.
+
+1.00 Sat Sep 19 02:52:31 PDT 2009
+ - Switched to Test::Builder::Tester for testing to get rid of
+ problems with threaded Perls and Test::Builder::Capture.
+ - Fixed test levels for call so that test failures are reported
+ at the invocation of the test rather than down inside the module.
0.10 Sun Aug 23 15:29:16 PDT 2009
- Added license
Modified: trunk/libtest-xml-simple-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/META.yml?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/META.yml (original)
+++ trunk/libtest-xml-simple-perl/META.yml Mon Sep 21 19:05:34 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Test-XML-Simple
-version: 0.10
+version: 1.00
abstract: easy testing for XML
author:
- Joe McMahon <mcmahon at cpan.org>
@@ -8,19 +8,17 @@
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
-build_requires:
- ExtUtils::MakeMaker: 0
requires:
- Test::Builder: 0
- Test::LongString: 0
- Test::More: 0
- Test::Tester: 0
- XML::LibXML: 0
+ Test::Builder: 0
+ Test::Builder::Tester: 0
+ Test::LongString: 0
+ Test::More: 0
+ XML::LibXML: 0
no_index:
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.54
+generated_by: ExtUtils::MakeMaker version 6.48
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: trunk/libtest-xml-simple-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/Makefile.PL?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/Makefile.PL (original)
+++ trunk/libtest-xml-simple-perl/Makefile.PL Mon Sep 21 19:05:34 2009
@@ -7,7 +7,7 @@
'LICENSE' => 'artistic',
'PREREQ_PM' => {
Test::Builder => 0,
- Test::Tester => 0,
+ Test::Builder::Tester => 0,
Test::More => 0,
Test::LongString => 0,
XML::LibXML => 0,
Modified: trunk/libtest-xml-simple-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/README?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/README (original)
+++ trunk/libtest-xml-simple-perl/README Mon Sep 21 19:05:34 2009
@@ -1,4 +1,4 @@
-Test::XML::Simple version 0.01
+Test::XML::Simple version 1.00
============================
Test::SML::Simple provides a test class which makes it easy to do basic
Modified: trunk/libtest-xml-simple-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/debian/changelog?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/debian/changelog (original)
+++ trunk/libtest-xml-simple-perl/debian/changelog Mon Sep 21 19:05:34 2009
@@ -1,10 +1,8 @@
-libtest-xml-simple-perl (0.10-1) UNRELEASED; urgency=low
-
- No release necessary. Added a license, minor stuff like that.
- IGNORE-VERSION: 0.10-1
+libtest-xml-simple-perl (1.00-1) UNRELEASED; urgency=low
[ Jonathan Yu ]
* New upstream release
+ + Switch to Test::Builder::Tester instead of Test::Tester
* Standards-Version 3.8.3 (remove version dependency on perl)
* Use new short rules format
* Remove libtest-simple-perl; it comes with perl-modules
@@ -17,7 +15,7 @@
[ Ryan Niebur ]
* Update jawnsy's email address
- -- Ryan Niebur <ryanryan52 at gmail.com> Tue, 01 Sep 2009 21:19:53 -0700
+ -- Jonathan Yu <jawnsy at cpan.org> Mon, 21 Sep 2009 11:05:23 -0400
libtest-xml-simple-perl (0.09-2) unstable; urgency=low
Modified: trunk/libtest-xml-simple-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/debian/control?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/debian/control (original)
+++ trunk/libtest-xml-simple-perl/debian/control Mon Sep 21 19:05:34 2009
@@ -3,7 +3,7 @@
Priority: optional
Build-Depends: debhelper (>= 7.0.8), quilt (>= 0.46-7)
Build-Depends-Indep: perl, libtest-longstring-perl, libtest-pod-coverage-perl,
- libxml-libxml-perl, libtest-tester-perl, libtest-pod-perl
+ libxml-libxml-perl, libtest-pod-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Jaldhar H. Vyas <jaldhar at debian.org>, Alex Muntada <alexm at alexm.org>,
Jonathan Yu <jawnsy at cpan.org>
Modified: trunk/libtest-xml-simple-perl/lib/Test/XML/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/lib/Test/XML/Simple.pm?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/lib/Test/XML/Simple.pm (original)
+++ trunk/libtest-xml-simple-perl/lib/Test/XML/Simple.pm Mon Sep 21 19:05:34 2009
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.10';
+our $VERSION = '1.00';
use Test::Builder;
use Test::More;
@@ -42,19 +42,21 @@
sub _valid_xml {
my $xml = shift;
return $Xml if defined($xml) and $xml eq $last_xml_string;
-
+
+ local $Test::Builder::Level = $Test::Builder::Level + 2;
return fail("XML is not defined") unless defined $xml;
return fail("XML is missing") unless $xml;
return fail("string can't contain XML: no tags")
unless ($xml =~ /</ and $xml =~/>/);
eval {$Xml = XML::LibXML->new->parse_string($xml)};
- $@ ? return fail($@)
+ $@ ? do { chomp $@; return fail($@) }
: return $Xml;
}
sub _find {
my ($xml_xpath, $xpath) = @_;
my @nodeset = $xml_xpath->findnodes($xpath);
+ local $Test::Builder::Level = $Test::Builder::Level + 2;
return fail("Couldn't find $xpath") unless @nodeset;
wantarray ? @nodeset : \@nodeset;
}
@@ -84,6 +86,7 @@
sub _xml_is {
my ($comp_sub, $xml, $xpath, $value, $comment) = @_;
+ local $Test::Builder::Level = $Test::Builder::Level + 2;
my $parsed_xml = _valid_xml($xml);
return 0 unless $parsed_xml;
@@ -161,12 +164,14 @@
}
if (! $found) {
$comment = "(no comment)" unless defined $comment;
- return ok(0, "$comment - no match in tag contents (including CDATA)");
+ local $Test::Builder::Level = $Test::Builder::Level + 2;
+ return ok(0, "$comment - no match in tag contents (including CDATA)");
}
}
else {
my $got = $node->toString;
$got =~ s/^.*="(.*)"/$1/;
+ local $Test::Builder::Level = $Test::Builder::Level + 2;
return $like_sub->(like $got, $regex, $comment);
}
}
Modified: trunk/libtest-xml-simple-perl/t/03valid.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/t/03valid.t?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/t/03valid.t (original)
+++ trunk/libtest-xml-simple-perl/t/03valid.t Mon Sep 21 19:05:34 2009
@@ -1,5 +1,5 @@
-use Test::Tester;
-use Test::More tests=>8;
+use Test::Builder::Tester tests=>4;
+use Test::More;
use Test::XML::Simple;
my $totally_invalid = <<EOS;
@@ -24,41 +24,21 @@
</CATALOG>
EOS
- at results = run_tests(
- sub {
- xml_valid(undef, "no xml")
- }
- );
-is($results[1]->{diag}, '', "skipped");
-ok(!$results[1]->{ok}, 'failed as expected');
+test_out("not ok 1 - XML is not defined");
+test_fail(+1);
+xml_valid(undef, "no xml");
+test_test('undef');
- at results = run_tests(
- sub {
- xml_valid($totally_invalid, "invalid xml")
- }
- );
-is($results[1]->{diag}, '', "skipped");
-ok(!$results[1]->{ok}, 'failed as expected');
+test_out("not ok 1 - string can't contain XML: no tags");
+test_fail(+1);
+xml_valid($totally_invalid, "invalid xml");
+test_test('non-XML string');
- at results = run_tests(
- sub {
- xml_valid($broken_xml, "invalid xml")
- },
- {
- ok=>undef
- }
- );
-is($results[1]->{diag}, '', "skipped");
-ok(!$results[1]->{ok}, 'failed as expected');
+test_out("not ok 1 - :2: parser error : Premature end of data in tag imatag line 1");
+test_fail(+1);
+xml_valid($broken_xml, "invalid xml");
+test_test('bad XML');
- at results = run_tests(
- sub {
- xml_valid($valid, "good xml")
- },
- {
- ok=>1,
- }
- );
-
-is($results[1]->{diag}, '', "ran");
-ok($results[1]->{ok}, 'succeeded as expected');
+test_out("ok 1 - good xml");
+xml_valid($valid, "good xml");
+test_test('good xml');
Modified: trunk/libtest-xml-simple-perl/t/04node.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/t/04node.t?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/t/04node.t (original)
+++ trunk/libtest-xml-simple-perl/t/04node.t Mon Sep 21 19:05:34 2009
@@ -1,5 +1,4 @@
-use Test::Tester;
-use Test::More tests=>4;
+use Test::Builder::Tester tests => 4;
use Test::XML::Simple;
my $xml = <<EOS;
@@ -16,39 +15,20 @@
</CATALOG>
EOS
- at results = run_tests(
- sub {
- xml_node($xml, "//ARTIST", "good node")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found node');
+test_out('ok 1 - good node');
+xml_node($xml, "//ARTIST", "good node");
+test_test('xml_node, good node');
- at results = run_tests(
- sub {
- xml_node($xml, "/CATALOG/ARTIST", "bad path")
- },
- );
-ok(!$results[1]->{ok}, 'failed as expected');
+test_out("not ok 1 - Couldn't find /CATALOG/ARTIST");
+test_fail(+1);
+xml_node($xml, "/CATALOG/ARTIST", "bad path");
+test_test('xml_node, bad path');
- at results = run_tests(
- sub {
- xml_node($xml, "/CATALOG/CD/ARTIST", "full path")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found full path');
+test_out('ok 1 - full path');
+xml_node($xml, "/CATALOG/CD/ARTIST", "full path");
+test_test('xml_node, full path');
- at results = run_tests(
- sub {
- xml_node($xml, "//FORMAT", "bad node")
- },
- {
- ok=>0,
- }
- );
-ok(!$results[1]->{ok}, 'failed as expected');
+test_out("not ok 1 - Couldn't find //FORMAT");
+test_fail(+1);
+xml_node($xml, "//FORMAT", "bad node");
+test_test('xml_node, bad node');
Modified: trunk/libtest-xml-simple-perl/t/05is.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/t/05is.t?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/t/05is.t (original)
+++ trunk/libtest-xml-simple-perl/t/05is.t Mon Sep 21 19:05:34 2009
@@ -1,4 +1,4 @@
-use Test::Tester;
+use Test::Builder::Tester;
use Test::More tests=>6;
use Test::XML::Simple;
@@ -16,62 +16,40 @@
</CATALOG>
EOS
- at results = run_tests(
- sub {
- xml_is($xml, "//ARTIST", 'Sting', "good node")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found node');
+test_out("ok 1 - good node");
+xml_is($xml, "//ARTIST", 'Sting', "good node");
+test_test("node match");
- at results = run_tests(
- sub {
- xml_is_long($xml, "//ARTIST", 'Sting', "good node")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found node');
+test_out('ok 1 - good node');
+xml_is_long($xml, "//ARTIST", 'Sting', "good node");
+test_test("long node match");
- at results = run_tests(
- sub {
- xml_is($xml, "/CATALOG/CD/ARTIST", 'Sting', "full path")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found path');
+test_out('ok 1 - full path');
+xml_is($xml, "/CATALOG/CD/ARTIST", 'Sting', "full path");
+test_test("node match");
- at results = run_tests(
- sub {
- xml_is_long($xml, "/CATALOG/CD/ARTIST", 'Sting', "full path")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found path');
+test_out('ok 1 - full path');
+xml_is_long($xml, "/CATALOG/CD/ARTIST", 'Sting', "full path");
+test_test("long node match");
- at results = run_tests(
- sub {
- xml_is($xml, "//ARTIST", 'Weird Al', "good node")
- },
- {
- ok=>0,
- }
- );
-ok(!$results[1]->{ok}, 'no node');
+test_out('not ok 1 - good node');
+test_err(qq(# Failed test 'good node'
+# at t/05is.t line 43.
+# got: "Sting"
+# length: 5
+# expected: "Weird Al"
+# length: 8
+# strings begin to differ at char 1) );
+xml_is($xml, "//ARTIST", 'Weird Al', "good node");
+test_test("node miss");
- at results = run_tests(
- sub {
- xml_is($xml, "/CATALOG/CD/ARTIST", 'Weird Al', "full path")
- },
- {
- ok=>0,
- }
- );
-ok(!$results[1]->{ok}, 'no path');
+test_out('not ok 1 - full path');
+test_err(qq(# Failed test 'full path'
+# at t/05is.t line 54.
+# got: "Sting"
+# length: 5
+# expected: "Weird Al"
+# length: 8
+# strings begin to differ at char 1) );
+xml_is($xml, "/CATALOG/CD/ARTIST", 'Weird Al', "full path");
+test_test("full path miss");
Modified: trunk/libtest-xml-simple-perl/t/06like.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/t/06like.t?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/t/06like.t (original)
+++ trunk/libtest-xml-simple-perl/t/06like.t Mon Sep 21 19:05:34 2009
@@ -1,5 +1,4 @@
-use Test::Tester;
-use Test::More tests=>4;
+use Test::Builder::Tester tests=>4;
use Test::XML::Simple;
my $xml = <<EOS;
@@ -16,42 +15,22 @@
</CATALOG>
EOS
- at results = run_tests(
- sub {
- xml_like($xml, "//ARTIST", qr/st/i, "good node")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found node');
+test_out('ok 1 - good node');
+xml_like($xml, "//ARTIST", qr/st/i, "good node");
+test_test('node match');
- at results = run_tests(
- sub {
- xml_like($xml, "/CATALOG/CD/ARTIST", qr/ing/, "full path")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, 'found path');
+test_out('ok 1 - full path');
+xml_like($xml, "/CATALOG/CD/ARTIST", qr/ing/, "full path");
+test_test('full path match');
- at results = run_tests(
- sub {
- xml_like($xml, "//ARTIST", qr/Weird Al/, "good node")
- },
- {
- ok=>0,
- }
- );
-ok(!$results[1]->{ok}, 'no node');
+test_out('not ok 1 - good node - no match in tag contents (including CDATA)');
+test_err(qq(# Failed test 'good node - no match in tag contents (including CDATA)'
+# at t/06like.t line 29.) );
+xml_like($xml, "//ARTIST", qr/Weird Al/, "good node");
+test_test('bad node match');
- at results = run_tests(
- sub {
- xml_like($xml, "/CATALOG/CD/ARTIST", qr/Weird Al/, "full path")
- },
- {
- ok=>0,
- }
- );
-ok(!$results[1]->{ok}, 'no path');
+test_out('not ok 1 - full path - no match in tag contents (including CDATA)');
+test_err(qq(# Failed test 'full path - no match in tag contents (including CDATA)'
+# at t/06like.t line 35.) );
+xml_like($xml, "/CATALOG/CD/ARTIST", qr/Weird Al/, "full path");
+test_test('bad full path match');
Modified: trunk/libtest-xml-simple-perl/t/07deeply.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/t/07deeply.t?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/t/07deeply.t (original)
+++ trunk/libtest-xml-simple-perl/t/07deeply.t Mon Sep 21 19:05:34 2009
@@ -1,5 +1,4 @@
-use Test::Tester;
-use Test::More tests=>2;
+use Test::Builder::Tester tests=>2;
use Test::XML::Simple;
my $xml = <<EOS;
@@ -20,22 +19,10 @@
<ARTIST>Sting</ARTIST>
EOS
-my @results = run_tests(
- sub {
- xml_is_deeply($xml, "//ARTIST", $fragment, "deep match")
- },
- {
- ok=>1,
- }
- );
-ok $results[1]->{ok}, "deep match";
+test_out("ok 1 - deep match");
+xml_is_deeply($xml, "//ARTIST", $fragment, "deep match");
+test_test('deep match');
- at results = run_tests(
- sub {
- xml_is_deeply($xml, "/", $xml, "identical match")
- },
- {
- ok=>1,
- }
- );
-ok $results[1]->{ok}, "identity match";
+test_out('ok 1 - identical match');
+xml_is_deeply($xml, "/", $xml, "identical match");
+test_test('identical match');
Modified: trunk/libtest-xml-simple-perl/t/08attr.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-xml-simple-perl/t/08attr.t?rev=44552&op=diff
==============================================================================
--- trunk/libtest-xml-simple-perl/t/08attr.t (original)
+++ trunk/libtest-xml-simple-perl/t/08attr.t Mon Sep 21 19:05:34 2009
@@ -1,46 +1,26 @@
-use Test::Tester;
-use Test::More tests=>3;
+use Test::Builder::Tester tests=>3;
use Test::XML::Simple;
my $with_attr = <<EOS;
<results total="1">this is a result</results>
EOS
-my @results = run_tests(
- sub {
- xml_is($with_attr, '//results/@total', "1", "nonempty works")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, "nonempty");
+test_out('ok 1 - nonempty works');
+xml_is($with_attr, '//results/@total', "1", "nonempty works");
+test_test('nonempty');
my $two_tag = <<EOS;
<results total="0"></results>
EOS
- at results = run_tests(
- sub {
- xml_is($two_tag, '//results/@total', "0", "two-tag works")
- },
- {
- ok=>1,
- }
- );
-
-ok($results[1]->{ok}, "two-tag");
+test_out('ok 1 - two-tag works');
+xml_is($two_tag, '//results/@total', "0", "two-tag works");
+test_test('two-tag');
my $collapsed = <<EOS;
<results total="0"/>
EOS
- at results = run_tests(
- sub {
- xml_is($collapsed, '//results/@total', "0", "collapsed works")
- },
- {
- ok=>1,
- }
- );
-ok($results[1]->{ok}, "collapsed");
+test_out('ok 1 - collapsed works');
+xml_is($collapsed, '//results/@total', "0", "collapsed works");
+test_test('collapsed');
More information about the Pkg-perl-cvs-commits
mailing list