From: <bi...@us...> - 2012-06-24 19:52:50
|
Revision: 7961 http://oorexx.svn.sourceforge.net/oorexx/?rev=7961&view=rev Author: bigrixx Date: 2012-06-24 19:52:44 +0000 (Sun, 24 Jun 2012) Log Message: ----------- start of some Text node test cases Modified Paths: -------------- incubator/orxutils/xml/xmldom.cls Added Paths: ----------- incubator/orxutils/xml/characterdata.testgroup Added: incubator/orxutils/xml/characterdata.testgroup =================================================================== --- incubator/orxutils/xml/characterdata.testgroup (rev 0) +++ incubator/orxutils/xml/characterdata.testgroup 2012-06-24 19:52:44 UTC (rev 7961) @@ -0,0 +1,114 @@ +#!/usr/bin/rexx +/* + SVN Revision: $Rev: 3371 $ + Change Date: $Date: 2008-09-21 00:33:29 -0400 (Sun, 21 Sep 2008) $ +*/ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2005-2010 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ + parse source . . fileSpec; + + group = .TestGroup~new(fileSpec) + group~add(.text.testGroup) + + if group~isAutomatedTest then return group + + testResult = group~suite~execute~~print + +return testResult +-- End of entry point. + +::requires "ooTest.frm" -- load the ooRexxUnit classes +::requires "xmldom.cls" + +::class "characterdata.testGroup" subclass ooTestCase public +::method setup + expose dom document + dom = .ooRexxDOM~implementation + document = dom~createDocument + +::attribute dom +::attribute document +::attribute nodeName +::attribute nodeClass +::attribute nodeType + +::method testBaseNode + root = self~document~createElement("root") + + node = self~createNode("xyz") + + self~assertTrue(node~isa(self~nodeclass)) + self~assertEquals(self~nodeName, node~nodeName) + self~assertEquals(self~nodeName, node~localName) + self~assertEquals("xyz", node~data) + self~assertEquals("xyz", node~nodeValue) + self~assertEquals("xyz"~length, node~length) + self~assertEquals(self~nodeType, node~nodetype) + self~assertNull(node~parentNode) + self~assertNull(node~nextSibling) + self~assertNull(node~previousSibling) + self~assertNull(node~firstChild) + self~assertNull(node~lastChild) + self~assertNull(node~attributes) + self~assertNull(node~prefix) + self~assertNull(node~namespaceURI) + self~assertNull(node~item(0)) + self~assertFalse(node~hasAttributes) + self~assertFalse(node~hasChildNodes) + + self~assertEquals(0, node~childNodes~length) + + -- add this to the part + root~appendChild(node) + + self~assertSame(root, node~parentNode) + self~assertEquals("xyz", root~textContent) + -- the text content does not change the element nodeValue + self~assertEquals(.nil, root~nodeValue) + +::class "text.testgroup" subclass characterdata.testgroup public +::method setup + forward class(super) continue + self~nodeName = "#text" + self~nodeClass = .Text + self~nodeType = .Node~TEXT_NODE + +::method createNode + use arg text + return self~document~createTextNode(text) + + Modified: incubator/orxutils/xml/xmldom.cls =================================================================== --- incubator/orxutils/xml/xmldom.cls 2012-06-24 19:52:03 UTC (rev 7960) +++ incubator/orxutils/xml/xmldom.cls 2012-06-24 19:52:44 UTC (rev 7961) @@ -1076,9 +1076,11 @@ ::attribute prefix SET -- this is an error by default .DomErrors~raiseError(.DomErrors~NAMESPACE_ERR) +-- for node types that don't support a real localname, +-- this is the same as nodeName ::attribute localName GET use strict arg - return .nil + return self~nodeName ::attribute baseURI GET use strict arg return .nil This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |