You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2001/09/16 17:22:19 UTC

cvs commit: xml-xerces/perl/t DOM_Attr.t DOM_Element.t IDOM_Attr.t IDOM_Element.t

jasons      01/09/16 08:22:19

  Added:       perl/t   DOM_Attr.t DOM_Element.t IDOM_Attr.t IDOM_Element.t
  Log:
  more tests
  
  Revision  Changes    Path
  1.1                  xml-xerces/perl/t/DOM_Attr.t
  
  Index: DOM_Attr.t
  ===================================================================
  # Before `make install' is performed this script should be runnable
  # with `make test'. After `make install' it should work as `perl
  # DOM_Attr.t'
  
  ######################### We start with some black magic to print on failure.
  
  # Change 1..1 below to 1..last_test_to_print .
  # (It may become useful if the test is moved to ./t subdirectory.)
  
  BEGIN { $| = 1; print "1..8\n"; }
  END {print "not ok 1\n" unless $loaded;}
  use Carp;
  use XML::Xerces;
  
  use lib 't';
  use TestUtils qw(result $DOM $PERSONAL_FILE_NAME);
  use vars qw($i $loaded);
  use strict;
  
  $loaded = 1;
  $i = 1;
  result($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):
  
  my $empty_attr = XML::Xerces::DOM_Attr->new();
  result($empty_attr->isa('XML::Xerces::DOM_Attr'));
  result($empty_attr->isNull());
  
  $DOM->parse($PERSONAL_FILE_NAME);
  
  my $doc = $DOM->getDocument();
  my $doctype = $doc->getDoctype();
  my @persons = $doc->getElementsByTagName('person');
  
  # test getting the attribute node
  my $attr = $persons[0]->getAttributeNode('id');
  result($attr->isa('XML::Xerces::DOM_Attr'));
  result($attr->getValue() eq $persons[0]->getAttribute('id'));
  
  # test the assignment operator
  $empty_attr = $attr;
  result($empty_attr->getValue() eq $attr->getValue());
  
  # test the equality operator
  result($empty_attr == $attr);
  
  # test the copy constructor
  my $attr_copy = $attr->new();
  result($attr->getValue() eq $attr_copy->getValue());
  
  
  
  
  
  1.1                  xml-xerces/perl/t/DOM_Element.t
  
  Index: DOM_Element.t
  ===================================================================
  # Before `make install' is performed this script should be runnable
  # with `make test'. After `make install' it should work as `perl
  # DOM_Element.t'
  
  ######################### We start with some black magic to print on failure.
  
  # Change 1..1 below to 1..last_test_to_print .
  # (It may become useful if the test is moved to ./t subdirectory.)
  
  BEGIN { $| = 1; print "1..4\n"; }
  END {print "not ok 1\n" unless $loaded;}
  use Carp;
  use XML::Xerces;
  
  use lib 't';
  use TestUtils qw(result $DOM $PERSONAL_FILE_NAME);
  use vars qw($i $loaded);
  use strict;
  
  $loaded = 1;
  $i = 1;
  result($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):
  
  $DOM->parse($PERSONAL_FILE_NAME);
  
  my $doc = $DOM->getDocument();
  my $doctype = $doc->getDoctype();
  my @persons = $doc->getElementsByTagName('person');
  my @names = $doc->getElementsByTagName('name');
  
  # try to set an Attribute, 'foo', to undef
  result(!$persons[0]->setAttribute('foo',undef));
  
  # try to set an Attribute, undef, to 'foo'
  result(!$persons[0]->setAttribute(undef,'foo'));
  
  # ensure that actual_cast() is being called
  result(ref $persons[0] eq 'XML::Xerces::DOM_Element');
  
  
  
  1.1                  xml-xerces/perl/t/IDOM_Attr.t
  
  Index: IDOM_Attr.t
  ===================================================================
  # Before `make install' is performed this script should be runnable
  # with `make test'. After `make install' it should work as `perl
  # IDOM_Attr.t'
  
  ######################### We start with some black magic to print on failure.
  
  # Change 1..1 below to 1..last_test_to_print .
  # (It may become useful if the test is moved to ./t subdirectory.)
  
  BEGIN { $| = 1; print "1..3\n"; }
  END {print "not ok 1\n" unless $loaded;}
  use Carp;
  use XML::Xerces;
  
  use lib 't';
  use TestUtils qw(result $IDOM $PERSONAL_FILE_NAME);
  use vars qw($i $loaded);
  use strict;
  
  $loaded = 1;
  $i = 1;
  result($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):
  
  $IDOM->parse($PERSONAL_FILE_NAME);
  
  my $doc = $IDOM->getDocument();
  my $doctype = $doc->getDoctype();
  my @persons = $doc->getElementsByTagName('person');
  
  # test getting the attribute node
  my $attr = $persons[0]->getAttributeNode('id');
  result($attr->isa('XML::Xerces::IDOM_Attr'));
  
  result($attr->getValue() eq $persons[0]->getAttribute('id'));
  
  
  
  1.1                  xml-xerces/perl/t/IDOM_Element.t
  
  Index: IDOM_Element.t
  ===================================================================
  # Before `make install' is performed this script should be runnable
  # with `make test'. After `make install' it should work as `perl
  # IDOM_Element.t'
  
  ######################### We start with some black magic to print on failure.
  
  # Change 1..1 below to 1..last_test_to_print .
  # (It may become useful if the test is moved to ./t subdirectory.)
  
  BEGIN { $| = 1; print "1..4\n"; }
  END {print "not ok 1\n" unless $loaded;}
  use Carp;
  use XML::Xerces;
  
  use lib 't';
  use TestUtils qw(result $IDOM $PERSONAL_FILE_NAME);
  use vars qw($i $loaded);
  use strict;
  
  $loaded = 1;
  $i = 1;
  result($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):
  
  $IDOM->parse($PERSONAL_FILE_NAME);
  
  my $doc = $IDOM->getDocument();
  my $doctype = $doc->getDoctype();
  my @persons = $doc->getElementsByTagName('person');
  my @names = $doc->getElementsByTagName('name');
  
  # try to set an Attribute, 'foo', to undef
  result(!$persons[0]->setAttribute('foo',undef));
  
  # try to set an Attribute, undef, to 'foo'
  result(!$persons[0]->setAttribute(undef,'foo'));
  
  # ensure that actual_cast() is being called
  result(ref $persons[0] eq 'XML::Xerces::IDOM_Element');
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org