Commits

Anonymous committed 5a2dfe8

Removed Files:
t/05dombasic.t
old stuff ...

Comments (0)

Files changed (1)

t/05dombasic.t

-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-use Test;
-BEGIN { plan tests=>25 }
-END {ok(0) unless $loaded;}
-use XML::LibXML;
-$loaded = 1;
-ok($loaded);
-
-######################### End of black magic.
-
-# Insert your test code below (better if it prints "ok 13"
-# (correspondingly "not ok 13") depending on the success of chunk 13
-# of the test code):
-
-# this performs general dom tests
-
-my $version = "1.0";
-my $enc     = "iso-8859-1";
-my $testtxt = "test";
-my $file    = "example/dromeds.xml";
-
-my $dom = XML::LibXML::Document->createDocument( $version, $enc );
-ok($dom);
-
-# this feature is for quick and dirty people ;)
-my $dom2 = XML::LibXML::Document->createDocument( );
-ok( $dom2
-    && $dom2->getEncoding() eq 'UTF-8' 
-    && $dom2->getVersion() eq $version );
-
-my $xs = "<?xml version=\"$version\" encoding=\"$enc\"?>\n";
-my $str = $dom->toString;
-ok( $str eq $xs );
-
-my $elem = $dom->createElement( "element" );
-ok( defined $elem && $elem->getName() eq "element" );
-
-warn "1\n";
-$dom->setDocumentElement( $elem );
-warn "2\n";
-ok( $elem->isEqual( $dom->getDocumentElement() ) );
-warn "3\n";
-
-# lets test if we can overwrite the document element with an 
-# invalid element type
-my $attr = $dom->createAttribute( "test", "test" );
-ok( defined $attr && $attr->getValue() eq "test" );
-
-$dom->setDocumentElement( $attr );
-ok( $elem->isEqual( $dom->getDocumentElement() ) );
-
-my $node;
-{
-    my $dom3 = XML::LibXML::Document->createDocument( $version, $enc );
-    $node   = $dom3->createElement( $testtxt );
-    $dom3->setDocumentElement( $node );
-}
-
-# this ends scope and older versions should segfault here 
-ok( defined $node && $node->getName() eq $testtxt );
-
-{ 
-    use Devel::Peek;
-    my $dom3 = $node->getOwnerDocument();
-    ok( defined $dom3 && $dom3->isa( 'XML::LibXML::Document' ) ); 
-}
-
-# this ends scope and older versions should segfault here 
-ok( defined $node && $node->getName() eq $testtxt );
-
-$node = $dom2->createElement( $testtxt );
-$dom2->setDocumentElement( $node );
-my $node2 = $dom->importNode( $node );
-if ( defined $node2 ){
-    warn " # node not defined " unless defined $node2;
-    my $tdoc = $node2->getOwnerDocument();
-    warn "# doc not defined " unless defined $tdoc;
-    warn "# wrong doc" if $tdoc->isEqual( $dom2 );
-    ok( defined $node2 && defined $tdoc && $tdoc->isEqual( $dom ) == 1 );
-}
-else {
-    ok(0);
-}
-
-{
-    my $text = $dom->createTextNode( $testtxt );
-    ok( defined $text && $text->isa( "XML::LibXML::Text" ) );
-
-    $text = $dom->createComment( $testtxt );
-    ok( defined $text && $text->isa( "XML::LibXML::Comment" ) );
-
-    $text = $dom->createCDATASection( $testtxt );
-    ok( defined $text && $text->isa( "XML::LibXML::CDATASection" ) );
-}
-warn "node should be dropped here !\n";
-
-{
-    print "# PI tests\n";
-    my $pi = $dom->createPI( "foo", "bar" );
-    ok( $pi );
-    $pi->setData( foo=>"bar" );
-    ok( $pi->toString(), '<?foo foo="bar"?>');
-
-    $dom->appendChild( $pi );
-    my @clds = $dom->childNodes();
-    my $cnt_dn = scalar( @clds );
-    ok( $cnt_dn > 1 );
-
-    $node = $dom2->createElement( $testtxt );
-    $dom->appendChild( $node );
-    @clds = $dom->childNodes();
-    ok( scalar( @clds ), $cnt_dn );
-
-    my $dom3 = XML::LibXML::Document->new();
-    $dom3->insertPI( "foo", 'foo="bar"' );
-    my $pi2 = $dom3->firstChild;
-    ok( $pi2->toString(), '<?foo foo="bar"?>');
-}
-# parse tests
-
-print "# init the file parser\n";
-{
-    my $parser = XML::LibXML->new();
-    my $dom3    = $parser->parse_file( $file );
-    ok( defined $dom3 );
-    if ( defined $dom3 ) {
-      $elem   = $dom3->getDocumentElement();
-      ok( defined $elem && 
-          $elem->getType() == XML_ELEMENT_NODE &&
-          $elem->isa( "XML::LibXML::Element" ) );
-      ok( $dom3->URI, $file );
-      my $oldURI = $dom3->URI("foo.xml");
-      ok( $dom3->URI, "foo.xml" );
-      ok( $oldURI, $file );
-    }
-}
-
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.