Update of /cvsroot/net-script/netscript2/src/tests In directory usw-pr-cvs1:/tmp/cvs-serv1360 Modified Files: DOMCloneImportTest.pm DOMParserTest.pm FileRetrieverTest.pm test.html Added Files: DOMAppendRemoveTest.pm DOMCharacterDataTest.pm Removed Files: CharacterDataTest.pm Log Message: * added test for append and remove * fixed DOMParserTest --- NEW FILE: DOMAppendRemoveTest.pm --- #-------------------------------------------------------- # NetScript tests. # Class DOMAppendRemodveTest # $Id: DOMAppendRemoveTest.pm,v 1.1 2002/04/26 10:52:03 derkork Exp $ # # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. # (C) 2000-2002 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- use strict; #/** # This test tests the append and remove methods of the node. #*/ package tests::DOMAppendRemoveTest; use base qw(Test::Unit::TestCase); use XML::DOM2::DOMImplementation; use XML::DOM2::Document; use XML::DOM2::Node; #/** # Ctor. # @public #*/ sub new { my ($proto) = shift; my $this = $proto -> SUPER::new(@_); my $di = XML::DOM2::DOMImplementation -> new(); $this -> { m_Document } = $di -> createDocument( { namespaceURI => "http://www.insomnia-hq.de/netscript2", qualifiedName => "ns:root-node", doctype => undef }); return $this; } #/** # This sub tests the Append-function. #*/ sub test_append { my ( $this ) = @_; my $rootElement = $this -> { m_Document } -> documentElement(); my $newChild = $this -> { m_Document } -> createTextNode( { data => "This is a test" }); $rootElement -> appendChild( { newChild => $newChild }); # Test if root element now has the text node as child $this -> assert( $rootElement -> hasChildNodes() ); $this -> assert( $rootElement -> firstChild() -> data() eq "This is a test" ); } #/** # This test removes the document element from the document. #*/ sub test_remove { my ( $this ) = @_; my $rootElement = $this -> { m_Document } -> documentElement(); $this -> { m_Document } -> removeChild( { oldChild => $rootElement }); #test if the root element is gone $this -> assert( !defined( $this -> { m_Document } -> documentElement() ) ); } 1; --- NEW FILE: DOMCharacterDataTest.pm --- #-------------------------------------------------------- # NetScript tests. # Class DOMCharacterDataTest; # $Id: DOMCharacterDataTest.pm,v 1.1 2002/04/26 10:52:03 derkork Exp $ # # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. # (C) 2000-2002 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- use strict; package tests::DOMCharacterDataTest; use base qw(Test::Unit::TestCase); use XML::DOM2::CharacterData; sub new { my ($proto) = shift; my $this = $proto -> SUPER::new(@_); $this -> { m_CD } = XML::DOM2::CharacterData -> new(); return $this; } sub test_data { my ($this) = @_; $this -> { m_CD } -> data( { "data" => "Hello World!" } ); my $data = $this -> { m_CD } -> data(); $this -> assert( $data eq "Hello World!" ); } sub test_append { my ($this) = @_; $this -> { m_CD } -> data( { "data" => "Hello"} ); $this -> { m_CD } -> appendData( { "arg" => " World!"} ); my $data = $this -> { m_CD } -> data(); $this -> assert( $data eq "Hello World!" ); } sub test_length { my ($this) = @_; $this -> { m_CD } -> data( { "data" => "0123456789"} ); my $data = $this -> { m_CD } -> length(); $this -> assert( $data == 10 ); } sub test_delete { my ($this) = @_; $this -> { m_CD } -> data( { "data" => "0123456789" } ); $this -> { m_CD } -> deleteData( { "offset" => 2, "count" => 2 } ); my $data = $this -> { m_CD } -> data(); $this -> assert( $data eq "01456789" ); } sub test_insert { my ($this) = @_; $this -> { m_CD } -> data( { "data" => "0189"} ); $this -> { m_CD } -> insertData( { "offset" => 2, "arg" => "234567" } ); my $data = $this -> { m_CD } -> data(); $this -> assert( $data eq "0123456789" ); } sub test_replace { my ($this) = @_; $this -> { m_CD } -> data( { "data" => "0123456789"} ); $this -> { m_CD } -> replaceData( { "offset" => 2, "count" => 6, "arg" => " + 88 = "} ); my $data = $this -> { m_CD } -> data(); $this -> assert( $data eq "01 + 88 = 89" ); } sub test_substring { my ($this) = @_; $this -> { m_CD } -> data( { "data" => "0123456789"} ); my $data = $this -> { m_CD } -> substringData( { "offset" => 0, "count" => 10 } ); $this -> assert( $data eq "0123456789" ); } 1; Index: DOMCloneImportTest.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/tests/DOMCloneImportTest.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DOMCloneImportTest.pm 3 Feb 2002 22:34:45 -0000 1.1 --- DOMCloneImportTest.pm 26 Apr 2002 10:52:03 -0000 1.2 *************** *** 6,10 **** # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2001 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- --- 6,10 ---- # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2002 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- Index: DOMParserTest.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/tests/DOMParserTest.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DOMParserTest.pm 3 Feb 2002 22:34:45 -0000 1.1 --- DOMParserTest.pm 26 Apr 2002 10:52:03 -0000 1.2 *************** *** 6,10 **** # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2001 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- --- 6,10 ---- # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2002 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- *************** *** 58,63 **** my $element2 = $element -> childNodes() -> item({index => 0}); $this -> assert( $element2 -> nodeName() eq "doc:a"); ! $this -> assert( $element2 -> getAttribute({ name => "b"}) eq "c"); ! $this -> assert( $element2 -> getAttribute({ name => "d"}) eq "e"); } 1; --- 58,68 ---- my $element2 = $element -> childNodes() -> item({index => 0}); $this -> assert( $element2 -> nodeName() eq "doc:a"); ! $this -> assert( $element2 -> getAttributeNS({ ! localName => "b", ! namespaceURI => "http://www.insomnia-hq.de/netscript/dom2/test"}) ! eq "c"); ! $this -> assert( $element2 -> getAttributeNS({ ! localName => "d", ! namespaceURI => "http://www.insomnia-hq.de/netscript/dom2/test"}) eq "e"); } 1; Index: FileRetrieverTest.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/tests/FileRetrieverTest.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileRetrieverTest.pm 3 Feb 2002 22:34:45 -0000 1.4 --- FileRetrieverTest.pm 26 Apr 2002 10:52:03 -0000 1.5 *************** *** 6,10 **** # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2001 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- --- 6,10 ---- # NetScript and all related materials, such as documentation, # are protected under the terms and conditions of the Artistic License. ! # (C) 2000-2002 by Jan Thomä, insOMnia # mailto: ko...@in... #-------------------------------------------------------- Index: test.html =================================================================== RCS file: /cvsroot/net-script/netscript2/src/tests/test.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test.html 11 Oct 2001 21:35:55 -0000 1.1 --- test.html 26 Apr 2002 10:52:03 -0000 1.2 *************** *** 7,11 **** <br> <hr> ! <div align="center">NetScript 2.0 (c) 2000-2001 by insOMnia </div> </body> </html> --- 7,11 ---- <br> <hr> ! <div align="center">NetScript 2.0 (c) 2000-2002 by insOMnia </div> </body> </html> --- CharacterDataTest.pm DELETED --- |