r44549 - in /branches/upstream/libtest-xml-simple-perl/current: Changes META.yml Makefile.PL README 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:01:18 UTC 2009


Author: jawnsy-guest
Date: Mon Sep 21 19:01:06 2009
New Revision: 44549

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=44549
Log:
[svn-upgrade] Integrating new upstream version, libtest-xml-simple-perl (1.00)

Modified:
    branches/upstream/libtest-xml-simple-perl/current/Changes
    branches/upstream/libtest-xml-simple-perl/current/META.yml
    branches/upstream/libtest-xml-simple-perl/current/Makefile.PL
    branches/upstream/libtest-xml-simple-perl/current/README
    branches/upstream/libtest-xml-simple-perl/current/lib/Test/XML/Simple.pm
    branches/upstream/libtest-xml-simple-perl/current/t/03valid.t
    branches/upstream/libtest-xml-simple-perl/current/t/04node.t
    branches/upstream/libtest-xml-simple-perl/current/t/05is.t
    branches/upstream/libtest-xml-simple-perl/current/t/06like.t
    branches/upstream/libtest-xml-simple-perl/current/t/07deeply.t
    branches/upstream/libtest-xml-simple-perl/current/t/08attr.t

Modified: branches/upstream/libtest-xml-simple-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/Changes?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/Changes (original)
+++ branches/upstream/libtest-xml-simple-perl/current/Changes Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/META.yml?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/META.yml (original)
+++ branches/upstream/libtest-xml-simple-perl/current/META.yml Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/Makefile.PL?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/Makefile.PL (original)
+++ branches/upstream/libtest-xml-simple-perl/current/Makefile.PL Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/README?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/README (original)
+++ branches/upstream/libtest-xml-simple-perl/current/README Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/lib/Test/XML/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/lib/Test/XML/Simple.pm?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/lib/Test/XML/Simple.pm (original)
+++ branches/upstream/libtest-xml-simple-perl/current/lib/Test/XML/Simple.pm Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/t/03valid.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/t/03valid.t?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/t/03valid.t (original)
+++ branches/upstream/libtest-xml-simple-perl/current/t/03valid.t Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/t/04node.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/t/04node.t?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/t/04node.t (original)
+++ branches/upstream/libtest-xml-simple-perl/current/t/04node.t Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/t/05is.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/t/05is.t?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/t/05is.t (original)
+++ branches/upstream/libtest-xml-simple-perl/current/t/05is.t Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/t/06like.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/t/06like.t?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/t/06like.t (original)
+++ branches/upstream/libtest-xml-simple-perl/current/t/06like.t Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/t/07deeply.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/t/07deeply.t?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/t/07deeply.t (original)
+++ branches/upstream/libtest-xml-simple-perl/current/t/07deeply.t Mon Sep 21 19:01:06 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: branches/upstream/libtest-xml-simple-perl/current/t/08attr.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-xml-simple-perl/current/t/08attr.t?rev=44549&op=diff
==============================================================================
--- branches/upstream/libtest-xml-simple-perl/current/t/08attr.t (original)
+++ branches/upstream/libtest-xml-simple-perl/current/t/08attr.t Mon Sep 21 19:01:06 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