Shlomi Fish avatar Shlomi Fish committed 3de5bb9

Convert t/29id.t to Test::More .

Comments (0)

Files changed (1)

 use strict;
 use warnings;
 
-use Test;
+use Test::More;
 use XML::LibXML;
 
-BEGIN {
+{
     if (XML::LibXML::LIBXML_VERSION() >= 20623) {
         plan tests => 42;
     }
     else {
-        plan tests => 0;
-        print "# Skipping ID tests on libxml2 <= 2.6.23\n";
-	exit;
+        plan skip_all => 'Skipping ID tests on libxml2 <= 2.6.23';
     }
 }
 
   print "$msg\t$$n\n'",(ref $n ? $n->toString : "NULL"),"'\n";
 }
 
+# TEST:$do_validate=2;
 for my $do_validate (0..1) {
   my ($n,$doc,$root,$at);
-  ok( $doc = $parser->parse_string($xml1) );
+  # TEST*$do_validate
+  ok( $doc = $parser->parse_string($xml1), ' TODO : Add test name' );
   $root = $doc->getDocumentElement;
   $n = $doc->getElementById('foo');
-  ok( $root->isSameNode( $n ) );
+  # TEST*$do_validate
+  ok( $root->isSameNode( $n ), ' TODO : Add test name' );
 
   # old name
   $n = $doc->getElementsById('foo');
-  ok( $root->isSameNode( $n ) );
+  # TEST*$do_validate
+  ok( $root->isSameNode( $n ), ' TODO : Add test name' );
 
   $at = $n->getAttributeNode('id');
-  ok( $at );
-  ok( $at->isId );
+  # TEST*$do_validate
+  ok( $at, ' TODO : Add test name' );
+  # TEST*$do_validate
+  ok( $at->isId, ' TODO : Add test name' );
 
   $at = $root->getAttributeNode('notid');
-  ok( $at->isId == 0 );
+  # TEST*$do_validate
+  ok( $at->isId == 0, ' TODO : Add test name' );
 
   # _debug("1: foo: ",$n);
   $doc->getDocumentElement->setAttribute('id','bar');
-  ok( $doc->validate ) if $do_validate;
+  # TEST
+  ok( $doc->validate, ' TODO : Add test name' ) if $do_validate;
   $n = $doc->getElementById('bar');
-  ok( $root->isSameNode( $n ) );
+  # TEST*$do_validate
+  ok( $root->isSameNode( $n ), ' TODO : Add test name' );
 
   # _debug("1: bar: ",$n);
   $n = $doc->getElementById('foo');
-  ok( !defined($n) );
+  # TEST*$do_validate
+  ok( !defined($n), ' TODO : Add test name' );
   # _debug("1: !foo: ",$n);
 
   my $test = $doc->createElement('root');
   $root->appendChild($test);
   $test->setAttribute('id','new');
-  ok( $doc->validate ) if $do_validate;
+  # TEST
+  ok( $doc->validate, ' TODO : Add test name' ) if $do_validate;
   $n = $doc->getElementById('new');
-  ok( $test->isSameNode( $n ) );
+  # TEST*$do_validate
+  ok( $test->isSameNode( $n ), ' TODO : Add test name' );
 
   $at = $n->getAttributeNode('id');
-  ok( $at );
-  ok( $at->isId );
+  # TEST*$do_validate
+  ok( $at, ' TODO : Add test name' );
+  # TEST*$do_validate
+  ok( $at->isId, ' TODO : Add test name' );
   # _debug("1: new: ",$n);
 }
 
 {
   my ($n,$doc,$root,$at);
-  ok( $doc = $parser->parse_string($xml2) );
+  # TEST
+  ok( $doc = $parser->parse_string($xml2), ' TODO : Add test name' );
   $root = $doc->getDocumentElement;
 
   $n = $doc->getElementById('foo');
-  ok( $root->isSameNode( $n ) );
+  # TEST
+  ok( $root->isSameNode( $n ), ' TODO : Add test name' );
   # _debug("1: foo: ",$n);
 
   $doc->getDocumentElement->setAttribute('xml:id','bar');
   $n = $doc->getElementById('foo');
-  ok( !defined($n) );
+  # TEST
+  ok( !defined($n), ' TODO : Add test name' );
   # _debug("1: !foo: ",$n);
 
   $n = $doc->getElementById('bar');
-  ok( $root->isSameNode( $n ) );
+  # TEST
+  ok( $root->isSameNode( $n ), ' TODO : Add test name' );
 
   $at = $n->getAttributeNode('xml:id');
-  ok( $at );
-  ok( $at->isId );
+  # TEST
+  ok( $at, ' TODO : Add test name' );
+  # TEST
+  ok( $at->isId, ' TODO : Add test name' );
 
   $n->setAttribute('id','FOO');
-  ok( $at->isSameNode($n->getAttributeNode('xml:id')) );
+  # TEST
+  ok( $at->isSameNode($n->getAttributeNode('xml:id')), ' TODO : Add test name' );
 
   $at = $n->getAttributeNode('id');
-  ok( $at );
-  ok( ! $at->isId );
+  # TEST
+  ok( $at, ' TODO : Add test name' );
+  # TEST
+  ok( ! $at->isId, ' TODO : Add test name' );
 
   $at = $n->getAttributeNodeNS('http://www.w3.org/XML/1998/namespace','id');
-  ok( $at );
-  ok( $at->isId );
+  # TEST
+  ok( $at, ' TODO : Add test name' );
+  # TEST
+  ok( $at->isId, ' TODO : Add test name' );
   # _debug("1: bar: ",$n);
 
   $doc->getDocumentElement->setAttributeNS('http://www.w3.org/XML/1998/namespace','id','baz');
   $n = $doc->getElementById('bar');
-  ok( !defined($n) );
+  # TEST
+  ok( !defined($n), ' TODO : Add test name' );
   # _debug("1: !bar: ",$n);
 
   $n = $doc->getElementById('baz');
-  ok( $root->isSameNode( $n ) );
+  # TEST
+  ok( $root->isSameNode( $n ), ' TODO : Add test name' );
   # _debug("1: baz: ",$n);
   $at = $n->getAttributeNodeNS('http://www.w3.org/XML/1998/namespace','id');
-  ok( $at );
-  ok( $at->isId );
+  # TEST
+  ok( $at, ' TODO : Add test name' );
+  # TEST
+  ok( $at->isId, ' TODO : Add test name' );
 
   $doc->getDocumentElement->setAttributeNS('http://www.w3.org/XML/1998/namespace','xml:id','bag');
   $n = $doc->getElementById('baz');
-  ok( !defined($n) );
+  # TEST
+  ok( !defined($n), ' TODO : Add test name' );
   # _debug("1: !baz: ",$n);
 
   $n = $doc->getElementById('bag');
-  ok( $root->isSameNode( $n ) );
+  # TEST
+  ok( $root->isSameNode( $n ), ' TODO : Add test name' );
   # _debug("1: bag: ",$n);
 
   $n->removeAttribute('id');
-  ok( $root->toString, '<root2 xml:id="bag"/>' );
+  # TEST
+  is( $root->toString, '<root2 xml:id="bag"/>', ' TODO : Add test name' );
 }
 
 1;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.