tests: Port avmplus e4x XML tests
This commit is contained in:
parent
0ac0ea21c5
commit
2e1f848144
|
@ -0,0 +1,123 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
import com.adobe.test.Utils;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("bug157597 - XML insertChildAfter()");
|
||||
|
||||
//TEST(1, true, XML.prototype.hasOwnProperty("insertChildAfter"));
|
||||
|
||||
var example:XML = <example>
|
||||
<two>2</two>
|
||||
</example>;
|
||||
|
||||
correct =
|
||||
<example>
|
||||
<two>2</two>
|
||||
<three>3</three>
|
||||
</example>;
|
||||
|
||||
example.insertChildAfter(example.two, <three>3</three>);
|
||||
|
||||
TEST(2, correct, example);
|
||||
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1 @@
|
|||
2 PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,123 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
import com.adobe.test.Utils;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("bug157597 - XML insertChildBefore()");
|
||||
|
||||
|
||||
|
||||
var example:XML = <example>
|
||||
<two>2</two>
|
||||
</example>;
|
||||
|
||||
correct =
|
||||
<example>
|
||||
<one>1</one>
|
||||
<two>2</two>
|
||||
</example>;
|
||||
|
||||
example.insertChildBefore(example.two, <one>1</one>);
|
||||
|
||||
TEST(2, correct, example);
|
||||
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1 @@
|
|||
2 PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,113 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
import com.adobe.test.Utils;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("bug157735 - XML comments()");
|
||||
|
||||
XML.ignoreComments = false;
|
||||
|
||||
var p = <p><!--this is a comment-->this is normal text</p>;
|
||||
|
||||
TEST(1, "this is normal text", p.toString());
|
||||
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1 @@
|
|||
1 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_ticks = 1
|
|
@ -0,0 +1,118 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
import com.adobe.test.Utils;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("bug158506");
|
||||
|
||||
|
||||
var x:XML =
|
||||
<order>
|
||||
<author name="Contino Chuck" sign="Virgo" /> </order>
|
||||
for each( var node:XML in x..author )
|
||||
{ var name:String = node.@name;
|
||||
var sign:String = node.@sign;
|
||||
TEST(1, "Contino Chuck", name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1 @@
|
|||
1 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_ticks = 1
|
|
@ -0,0 +1,164 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
import com.adobe.test.Utils;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* See http://bugzilla.mozilla.org/show_bug.cgi?id=564468
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// var SECTION = "564468";
|
||||
// var VERSION = "";
|
||||
// var TITLE = " XMLParser need to use caseless compares for ?XML and CDATA tags";
|
||||
// var bug = "564468";
|
||||
|
||||
|
||||
|
||||
// Unable to access xml declaration node via AS code so instead cause an
|
||||
// XMLParser::kUnterminatedXMLDeclaration error to be thrown by XMLParser.getNext().
|
||||
// Prior to this fix this code would throw an XMLParser::kUnterminatedProcessingInstruction
|
||||
// error was thrown since it fell into the "<?" processing instruction check block
|
||||
var err:String = "no error";
|
||||
try {
|
||||
var y:String = "<?xml version='1.0'?";
|
||||
var z:XML = new XML(y);
|
||||
} catch (e:Error) {
|
||||
err = Utils.grabError(e, e.toString());
|
||||
} finally {
|
||||
Assert.expectEq("lowercase xml", "Error #1092", err );
|
||||
}
|
||||
|
||||
err = "no error";
|
||||
try {
|
||||
var y:String = "<?XML version='1.0'?";
|
||||
var z:XML = new XML(y);
|
||||
} catch (e:Error) {
|
||||
err = Utils.grabError(e, e.toString());
|
||||
} finally {
|
||||
Assert.expectEq("uppercase xml", "Error #1092", err );
|
||||
}
|
||||
|
||||
err = "no error";
|
||||
try {
|
||||
var y:String = "<?Xml version='1.0'?";
|
||||
var z:XML = new XML(y);
|
||||
} catch (e:Error) {
|
||||
err = Utils.grabError(e, e.toString());
|
||||
} finally {
|
||||
Assert.expectEq("mixed xml", "Error #1092", err );
|
||||
}
|
||||
|
||||
|
||||
var lowerdata:String = "<text><![cdata[ This <> is some cdata!]]></text>";
|
||||
var lowerCDATA:XML = new XML(lowerdata);
|
||||
Assert.expectEq("lower CDATA", "<text><![CDATA[ This <> is some cdata!]]></text>", lowerCDATA.toXMLString() );
|
||||
|
||||
var mixeddata:String = "<text><![Cdata[ This <> is some cdata!]]></text>";
|
||||
var mixedCDATA:XML = new XML(mixeddata);
|
||||
Assert.expectEq("mixed CDATA", "<text><![CDATA[ This <> is some cdata!]]></text>", mixedCDATA.toXMLString() );
|
||||
|
||||
var upperdata:String = "<text><![CDATA[ This <> is some cdata!]]></text>";
|
||||
var upperCDATA:XML = new XML(upperdata);
|
||||
Assert.expectEq("upper CDATA", "<text><![CDATA[ This <> is some cdata!]]></text>", upperCDATA.toXMLString() );
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,9 @@
|
|||
Asserting for TypeError PASSED!
|
||||
lowercase xml PASSED!
|
||||
Asserting for TypeError PASSED!
|
||||
uppercase xml PASSED!
|
||||
Asserting for TypeError PASSED!
|
||||
mixed xml PASSED!
|
||||
lower CDATA PASSED!
|
||||
mixed CDATA PASSED!
|
||||
upper CDATA PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,189 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.1 - XML Constructor as Function");
|
||||
|
||||
x1 = XML();
|
||||
TEST(1, "xml", typeof(x1));
|
||||
TEST(2, true, x1 instanceof XML);
|
||||
|
||||
correct =
|
||||
<Envelope
|
||||
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:stock="http://mycompany.com/stocks"
|
||||
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<Body>
|
||||
<stock:GetLastTradePrice>
|
||||
<stock:symbol>DIS</stock:symbol>
|
||||
</stock:GetLastTradePrice>
|
||||
</Body>
|
||||
</Envelope>;
|
||||
|
||||
x1 = XML(correct);
|
||||
TEST(3, correct, x1);
|
||||
|
||||
text =
|
||||
"<Envelope" +
|
||||
" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
|
||||
" xmlns:stock=\"http://mycompany.com/stocks\"" +
|
||||
" soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" +
|
||||
" <Body>" +
|
||||
" <stock:GetLastTradePrice>" +
|
||||
" <stock:symbol>DIS</stock:symbol>" +
|
||||
" </stock:GetLastTradePrice>" +
|
||||
" </Body>" +
|
||||
"</Envelope>";
|
||||
|
||||
x1 = XML(text);
|
||||
TEST(4, correct, x1);
|
||||
|
||||
// Make sure it's not copied if it's XML
|
||||
x1 =
|
||||
<alpha>
|
||||
<bravo>two</bravo>
|
||||
</alpha>;
|
||||
|
||||
y1 = XML(x1);
|
||||
|
||||
x1.bravo = "three";
|
||||
|
||||
correct =
|
||||
<alpha>
|
||||
<bravo>three</bravo>
|
||||
</alpha>;
|
||||
|
||||
TEST(5, correct, y1);
|
||||
|
||||
// Make text node
|
||||
x1 = XML("4");
|
||||
TEST_XML(6, 4, x1);
|
||||
|
||||
x1 = XML(4);
|
||||
TEST_XML(7, 4, x1);
|
||||
|
||||
// Undefined and null should behave like ""
|
||||
x1 = XML(null);
|
||||
TEST_XML(8, "", x1);
|
||||
|
||||
x1 = XML(undefined);
|
||||
TEST_XML(9, "", x1);
|
||||
|
||||
XML.prettyPrinting = false;
|
||||
|
||||
var thisXML = "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>";
|
||||
var NULL_OBJECT = null;
|
||||
// value is null
|
||||
Assert.expectEq( "XML(null).valueOf().toString()", "", XML(null).valueOf().toString() );
|
||||
Assert.expectEq( "typeof XML(null)", "xml", typeof XML(null) );
|
||||
|
||||
// value is undefined
|
||||
Assert.expectEq( "XML(undefined).valueOf().toString()", "", XML(undefined).valueOf().toString() );
|
||||
Assert.expectEq( "typeof XML(undefined)", "xml", typeof XML(undefined) );
|
||||
|
||||
// value is not supplied
|
||||
Assert.expectEq( "XML().valueOf().toString()", "", XML().valueOf().toString() );
|
||||
Assert.expectEq( "typeof XML()", "xml", typeof XML() );
|
||||
|
||||
// value is supplied
|
||||
Assert.expectEq( "XML(thisXML).valueOf().toString()", thisXML, XML(thisXML).valueOf().toString() );
|
||||
Assert.expectEq( "typeof XML(thisXML)", "xml", typeof XML(thisXML) );
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,17 @@
|
|||
1 PASSED!
|
||||
2 PASSED!
|
||||
3 PASSED!
|
||||
4 PASSED!
|
||||
5 PASSED!
|
||||
6 PASSED!
|
||||
7 PASSED!
|
||||
8 PASSED!
|
||||
9 PASSED!
|
||||
XML(null).valueOf().toString() PASSED!
|
||||
typeof XML(null) PASSED!
|
||||
XML(undefined).valueOf().toString() PASSED!
|
||||
typeof XML(undefined) PASSED!
|
||||
XML().valueOf().toString() PASSED!
|
||||
typeof XML() PASSED!
|
||||
XML(thisXML).valueOf().toString() PASSED!
|
||||
typeof XML(thisXML) PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,241 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
import com.adobe.test.Utils;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
|
||||
START("13.4.2 - XML Constructor");
|
||||
|
||||
x1 = new XML();
|
||||
TEST(1, "xml", typeof(x1));
|
||||
TEST(2, true, x1 instanceof XML);
|
||||
|
||||
correct =
|
||||
<Envelope
|
||||
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:stock="http://mycompany.com/stocks"
|
||||
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<Body>
|
||||
<stock:GetLastTradePrice>
|
||||
<stock:symbol>DIS</stock:symbol>
|
||||
</stock:GetLastTradePrice>
|
||||
</Body>
|
||||
</Envelope>;
|
||||
|
||||
x1 = new XML(correct);
|
||||
TEST_XML(3, correct.toXMLString(), x1);
|
||||
|
||||
text =
|
||||
"<Envelope" +
|
||||
" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
|
||||
" xmlns:stock=\"http://mycompany.com/stocks\"" +
|
||||
" soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" +
|
||||
" <Body>" +
|
||||
" <stock:GetLastTradePrice>" +
|
||||
" <stock:symbol>DIS</stock:symbol>" +
|
||||
" </stock:GetLastTradePrice>" +
|
||||
" </Body>" +
|
||||
"</Envelope>";
|
||||
|
||||
x1 = new XML(text);
|
||||
TEST(4, correct, x1);
|
||||
|
||||
// Make sure it's a copy
|
||||
x1 =
|
||||
<alpha>
|
||||
<bravo>one</bravo>
|
||||
</alpha>;
|
||||
|
||||
y1 = new XML(x1);
|
||||
|
||||
x1.bravo.prependChild(<charlie>two</charlie>);
|
||||
|
||||
correct =
|
||||
<alpha>
|
||||
<bravo>one</bravo>
|
||||
</alpha>;
|
||||
|
||||
TEST(5, correct, y1);
|
||||
|
||||
// Make text node
|
||||
x1 = new XML("4");
|
||||
TEST_XML(6, "4", x1);
|
||||
|
||||
x1 = new XML(4);
|
||||
TEST_XML(7, "4", x1);
|
||||
|
||||
// Undefined and null should behave like ""
|
||||
x1 = new XML(null);
|
||||
TEST_XML(8, "", x1);
|
||||
|
||||
x1 = new XML(undefined);
|
||||
TEST_XML(9, "", x1);
|
||||
|
||||
var thisXML = "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>";
|
||||
|
||||
// value is null
|
||||
Assert.expectEq( "typeof new XML(null)", "xml", typeof new XML(null) );
|
||||
Assert.expectEq( "new XML(null) instanceof XML", true, new XML(null) instanceof XML);
|
||||
Assert.expectEq( "(new XML(null).nodeKind())", "text", (new XML(null)).nodeKind());
|
||||
Assert.expectEq( "MYOB = new XML(null); MYOB.toString()", "",
|
||||
(MYOB = new XML(null), MYOB.toString(), MYOB.toString()) );
|
||||
|
||||
// value is undefined
|
||||
Assert.expectEq( "typeof new XML(undefined)", "xml", typeof new XML(undefined) );
|
||||
Assert.expectEq( "new XML(undefined) instanceof XML", true, new XML(undefined) instanceof XML);
|
||||
Assert.expectEq( "(new XML(undefined).nodeKind())", "text", (new XML(undefined)).nodeKind());
|
||||
Assert.expectEq( "MYOB = new XML(undefined); MYOB.toString()", "",
|
||||
(MYOB = new XML(undefined), MYOB.toString(), MYOB.toString()) );
|
||||
|
||||
// value is not supplied
|
||||
Assert.expectEq( "typeof new XML()", "xml", typeof new XML() );
|
||||
Assert.expectEq( "new XML() instanceof XML", true, new XML() instanceof XML);
|
||||
Assert.expectEq( "(new XML().nodeKind())", "text", (new XML()).nodeKind());
|
||||
Assert.expectEq( "MYOB = new XML(); MYOB.toString()", "",
|
||||
(MYOB = new XML(), MYOB.toString(), MYOB.toString()) );
|
||||
|
||||
//value is a number
|
||||
Assert.expectEq( "typeof new XML(5)", "xml", typeof new XML(5) );
|
||||
Assert.expectEq( "new XML(5) instanceof XML", true, new XML(5) instanceof XML);
|
||||
Assert.expectEq( "(new XML(5).nodeKind())", "text", (new XML(5)).nodeKind());
|
||||
Assert.expectEq( "MYOB = new XML(5); MYOB.toString()", "5",
|
||||
(MYOB = new XML(5), MYOB.toString(), MYOB.toString()) );
|
||||
|
||||
//value is
|
||||
|
||||
// value is supplied
|
||||
XML.prettyPrinting = false;
|
||||
Assert.expectEq( "typeof new XML(thisXML)", "xml", typeof new XML(thisXML) );
|
||||
Assert.expectEq( "new XML(thisXML) instanceof XML", true, new XML(thisXML) instanceof XML);
|
||||
Assert.expectEq( "MYOB = new XML(thisXML); MYOB.toString()", "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>",
|
||||
(MYOB = new XML(thisXML), MYOB.toString(), MYOB.toString()) );
|
||||
|
||||
// Strongly typed XML objects
|
||||
var MYXML1:XML = new XML(thisXML);
|
||||
Assert.expectEq("Strongly typed XML object", new XML(thisXML).toString(), MYXML1.toString());
|
||||
|
||||
var MYXML2:XML = new XML(<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>);
|
||||
Assert.expectEq("var MYXML:XML = new XML(<x><a>b</a><c>d</c></x>);", new XML(thisXML).toString(), MYXML2.toString());
|
||||
|
||||
var MYXML3:XML = <XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>;
|
||||
Assert.expectEq("var MYXML:XML = <x><a>b</a><c>d</c></x>;", new XML(thisXML).toString(), MYXML3.toString());
|
||||
|
||||
var MYXML4:XML = new XML();
|
||||
var someXML = new XML();
|
||||
var someXML = someXML.toString();
|
||||
Assert.expectEq("var MYXML:XML = new XML()", someXML, MYXML4.toString());
|
||||
|
||||
var MYXML5:XML = new XML(5);
|
||||
Assert.expectEq("var MYXML:XML = new XML(5)", "5", MYXML5.toString());
|
||||
|
||||
var a = new XML("<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href='mystyle.css' type='text/css'?> <rdf>compiled</rdf>");
|
||||
|
||||
Assert.expectEq("XML with PI and comments", "compiled", a.toString());
|
||||
|
||||
try {
|
||||
var b = new XML("<a/><b/>");
|
||||
result = b;
|
||||
} catch(e1) {
|
||||
result = Utils.typeError(e1.toString());
|
||||
}
|
||||
|
||||
Assert.expectEq("new XML(\"<a/><b/>\")", "TypeError: Error #1088", result);
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,35 @@
|
|||
1 PASSED!
|
||||
2 PASSED!
|
||||
3 PASSED!
|
||||
4 PASSED!
|
||||
5 PASSED!
|
||||
6 PASSED!
|
||||
7 PASSED!
|
||||
8 PASSED!
|
||||
9 PASSED!
|
||||
typeof new XML(null) PASSED!
|
||||
new XML(null) instanceof XML PASSED!
|
||||
(new XML(null).nodeKind()) PASSED!
|
||||
MYOB = new XML(null); MYOB.toString() PASSED!
|
||||
typeof new XML(undefined) PASSED!
|
||||
new XML(undefined) instanceof XML PASSED!
|
||||
(new XML(undefined).nodeKind()) PASSED!
|
||||
MYOB = new XML(undefined); MYOB.toString() PASSED!
|
||||
typeof new XML() PASSED!
|
||||
new XML() instanceof XML PASSED!
|
||||
(new XML().nodeKind()) PASSED!
|
||||
MYOB = new XML(); MYOB.toString() PASSED!
|
||||
typeof new XML(5) PASSED!
|
||||
new XML(5) instanceof XML PASSED!
|
||||
(new XML(5).nodeKind()) PASSED!
|
||||
MYOB = new XML(5); MYOB.toString() PASSED!
|
||||
typeof new XML(thisXML) PASSED!
|
||||
new XML(thisXML) instanceof XML PASSED!
|
||||
MYOB = new XML(thisXML); MYOB.toString() PASSED!
|
||||
Strongly typed XML object PASSED!
|
||||
var MYXML:XML = new XML(<x><a>b</a><c>d</c></x>); PASSED!
|
||||
var MYXML:XML = <x><a>b</a><c>d</c></x>; PASSED!
|
||||
var MYXML:XML = new XML() PASSED!
|
||||
var MYXML:XML = new XML(5) PASSED!
|
||||
XML with PI and comments PASSED!
|
||||
new XML("<a/><b/>") PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,276 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
import com.adobe.test.Utils;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3 - XML Properties");
|
||||
|
||||
// Test defaults
|
||||
TEST(1, true, XML.ignoreComments);
|
||||
TEST(2, true, XML.ignoreProcessingInstructions);
|
||||
TEST(3, true, XML.ignoreWhitespace);
|
||||
TEST(4, true, XML.prettyPrinting);
|
||||
TEST(5, 2, XML.prettyIndent);
|
||||
|
||||
// ignoreComments
|
||||
x1 = <alpha><!-- comment --><bravo>one</bravo></alpha>;
|
||||
|
||||
correct = <alpha><bravo>one</bravo></alpha>;
|
||||
|
||||
TEST(6, correct, x1);
|
||||
|
||||
XML.ignoreComments = false;
|
||||
|
||||
x1 = <alpha><!-- comment --><bravo>one</bravo></alpha>;
|
||||
|
||||
correct =
|
||||
"<alpha>" + NL() +
|
||||
" <!-- comment -->" + NL() +
|
||||
" <bravo>one</bravo>" + NL() +
|
||||
"</alpha>";
|
||||
|
||||
TEST_XML(7, correct, x1);
|
||||
|
||||
|
||||
// ignoreProcessingInstructions
|
||||
XML.defaultSettings();
|
||||
x1 =
|
||||
<>
|
||||
<alpha>
|
||||
<?foo version="1.0" encoding="utf-8"?>
|
||||
<bravo>one</bravo>
|
||||
</alpha>
|
||||
</>;
|
||||
|
||||
correct =
|
||||
<alpha>
|
||||
<bravo>one</bravo>
|
||||
</alpha>;
|
||||
|
||||
TEST(8, correct, x1);
|
||||
|
||||
XML.ignoreProcessingInstructions = false;
|
||||
|
||||
x1 =
|
||||
<>
|
||||
<alpha>
|
||||
<?foo version="1.0" encoding="utf-8"?>
|
||||
<bravo>one</bravo>
|
||||
</alpha>
|
||||
</>;
|
||||
|
||||
correct =
|
||||
"<alpha>" + NL() +
|
||||
" <?foo version=\"1.0\" encoding=\"utf-8\"?>" + NL() +
|
||||
" <bravo>one</bravo>" + NL() +
|
||||
"</alpha>";
|
||||
|
||||
TEST_XML(9, correct, x1);
|
||||
|
||||
// ignoreWhitespace
|
||||
XML.defaultSettings();
|
||||
x1 = new XML("<alpha> \t\r\n\r\n<bravo> \t\r\n\r\none</bravo> \t\r\n\r\n</alpha>");
|
||||
|
||||
correct =
|
||||
"<alpha>" + NL() +
|
||||
" <bravo>one</bravo>" + NL() +
|
||||
"</alpha>";
|
||||
|
||||
TEST_XML(10, correct, x1);
|
||||
|
||||
XML.ignoreWhitespace = false;
|
||||
XML.prettyPrinting = false;
|
||||
|
||||
correct = "<alpha> \n\n<bravo> \n\none</bravo> \n\n</alpha>";
|
||||
x1 = new XML(correct);
|
||||
|
||||
TEST_XML(11, correct, x1);
|
||||
|
||||
// prettyPrinting
|
||||
XML.prettyPrinting = true;
|
||||
|
||||
x1 =<alpha>one<bravo>two</bravo><charlie/><delta>three<echo>four</echo></delta></alpha>;
|
||||
|
||||
correct = "<alpha>" + NL() +
|
||||
" one" + NL() +
|
||||
" <bravo>two</bravo>" + NL() +
|
||||
" <charlie/>" + NL() +
|
||||
" <delta>" + NL() +
|
||||
" three" + NL() +
|
||||
" <echo>four</echo>" + NL() +
|
||||
" </delta>" + NL() +
|
||||
"</alpha>";
|
||||
|
||||
TEST(12, correct, x1.toString());
|
||||
TEST(13, correct, x1.toXMLString());
|
||||
|
||||
XML.prettyPrinting = false;
|
||||
|
||||
correct = "<alpha>one<bravo>two</bravo><charlie/><delta>three<echo>four</echo></delta></alpha>";
|
||||
TEST(14, correct, x1.toString());
|
||||
TEST(15, correct, x1.toXMLString());
|
||||
|
||||
// prettyIndent
|
||||
XML.prettyPrinting = true;
|
||||
XML.prettyIndent = 3;
|
||||
|
||||
correct = "<alpha>" + NL() +
|
||||
" one" + NL() +
|
||||
" <bravo>two</bravo>" + NL() +
|
||||
" <charlie/>" + NL() +
|
||||
" <delta>" + NL() +
|
||||
" three" + NL() +
|
||||
" <echo>four</echo>" + NL() +
|
||||
" </delta>" + NL() +
|
||||
"</alpha>";
|
||||
|
||||
TEST(16, correct, x1.toString());
|
||||
TEST(17, correct, x1.toXMLString());
|
||||
|
||||
XML.prettyIndent = 0;
|
||||
|
||||
correct = "<alpha>" + NL() +
|
||||
"one" + NL() +
|
||||
"<bravo>two</bravo>" + NL() +
|
||||
"<charlie/>" + NL() +
|
||||
"<delta>" + NL() +
|
||||
"three" + NL() +
|
||||
"<echo>four</echo>" + NL() +
|
||||
"</delta>" + NL() +
|
||||
"</alpha>";
|
||||
|
||||
TEST(18, correct, x1.toString());
|
||||
TEST(19, correct, x1.toXMLString());
|
||||
|
||||
// settings()
|
||||
XML.defaultSettings();
|
||||
o = XML.settings();
|
||||
TEST(20, false, o.ignoreComments);
|
||||
TEST(21, false, o.ignoreProcessingInstructions);
|
||||
TEST(22, false, o.ignoreWhitespace);
|
||||
TEST(23, true, o.prettyPrinting);
|
||||
TEST(24, 0, o.prettyIndent);
|
||||
|
||||
// setSettings()
|
||||
o = XML.settings();
|
||||
o.ignoreComments = false;
|
||||
o.ignoreProcessingInstructions = false;
|
||||
o.ignoreWhitespace = false;
|
||||
o.prettyPrinting = false;
|
||||
o.prettyIndent = 7;
|
||||
|
||||
XML.setSettings(o);
|
||||
o = XML.settings();
|
||||
TEST(25, false, o.ignoreComments);
|
||||
TEST(26, false, o.ignoreProcessingInstructions);
|
||||
TEST(27, false, o.ignoreWhitespace);
|
||||
TEST(28, false, o.prettyPrinting);
|
||||
TEST(29, 7, o.prettyIndent);
|
||||
|
||||
// defaultSettings()
|
||||
XML.defaultSettings();
|
||||
o = XML.settings();
|
||||
TEST(30, false, o.ignoreComments);
|
||||
TEST(31, false, o.ignoreProcessingInstructions);
|
||||
TEST(32, false, o.ignoreWhitespace);
|
||||
TEST(33, false, o.prettyPrinting);
|
||||
TEST(34, 7, o.prettyIndent);
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,34 @@
|
|||
1 PASSED!
|
||||
2 PASSED!
|
||||
3 PASSED!
|
||||
4 PASSED!
|
||||
5 PASSED!
|
||||
6 PASSED!
|
||||
7 PASSED!
|
||||
8 PASSED!
|
||||
9 PASSED!
|
||||
10 PASSED!
|
||||
11 PASSED!
|
||||
12 PASSED!
|
||||
13 PASSED!
|
||||
14 PASSED!
|
||||
15 PASSED!
|
||||
16 PASSED!
|
||||
17 PASSED!
|
||||
18 PASSED!
|
||||
19 PASSED!
|
||||
20 PASSED!
|
||||
21 PASSED!
|
||||
22 PASSED!
|
||||
23 PASSED!
|
||||
24 PASSED!
|
||||
25 PASSED!
|
||||
26 PASSED!
|
||||
27 PASSED!
|
||||
28 PASSED!
|
||||
29 PASSED!
|
||||
30 PASSED!
|
||||
31 PASSED!
|
||||
32 PASSED!
|
||||
33 PASSED!
|
||||
34 PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,110 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.1 - XML.prototype");
|
||||
|
||||
Assert.expectEq( "typeof XML.prototype", "object", typeof XML.prototype);
|
||||
Assert.expectEq( "XML.prototype instanceof XML", false, XML.prototype instanceof XML);
|
||||
Assert.expectEq( "new XML().prototype instanceof XML", false, new XML().prototype instanceof XML);
|
||||
Assert.expectEq( "typeof (new XML().prototype)", "xml", typeof (new XML().prototype));
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,4 @@
|
|||
typeof XML.prototype PASSED!
|
||||
XML.prototype instanceof XML PASSED!
|
||||
new XML().prototype instanceof XML PASSED!
|
||||
typeof (new XML().prototype) PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_ticks = 1
|
|
@ -0,0 +1,139 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.2 - XML.ignoreComments");
|
||||
|
||||
var thisXML = "<XML><!--comment1--><TEAM>Giants</TEAM><CITY>San Francisco</CITY><!--comment2--></XML>"
|
||||
|
||||
XML.prettyPrinting = false;
|
||||
|
||||
// a) initial value of ignoreComments is true
|
||||
|
||||
Assert.expectEq( "XML.ignoreComments", true, XML.ignoreComments);
|
||||
|
||||
// toggling value works ok
|
||||
Assert.expectEq( "XML.ignoreComments = false, XML.ignoreComments", false, (XML.ignoreComments = false, XML.ignoreComments));
|
||||
Assert.expectEq( "XML.ignoreComments = true, XML.ignoreComments", true, (XML.ignoreComments = true, XML.ignoreComments));
|
||||
|
||||
// b) if ignoreComments is true, XML comments are ignored when construction the new XML objects
|
||||
Assert.expectEq( "MYXML = new XML(thisXML), MYXML.toString()", "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>",
|
||||
(XML.ignoreComments = true, MYXML = new XML(thisXML), MYXML.toString() ));
|
||||
Assert.expectEq( "MYXML = new XML(thisXML), MYXML.toString() with ignoreComemnts=false", "<XML><!--comment1--><TEAM>Giants</TEAM><CITY>San Francisco</CITY><!--comment2--></XML>",
|
||||
(XML.ignoreComments = false, MYXML = new XML(thisXML), MYXML.toString() ));
|
||||
|
||||
// If ignoreComments is true, XML constructor from another XML node ignores comments
|
||||
XML.ignoreComments = false;
|
||||
var MYXML = new XML(thisXML); // this XML node has comments
|
||||
XML.ignoreComments = true;
|
||||
var xml2 = new XML(MYXML); // this XML tree should not have comments
|
||||
Assert.expectEq( "xml2 = new XML(MYXML), xml2.toString()", "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>",
|
||||
(xml2.toString()) );
|
||||
XML.ignoreComments = false;
|
||||
var xml3 = new XML(MYXML); // this XML tree will have comments
|
||||
Assert.expectEq( "xml3 = new XML(MYXML), xml3.toString()", "<XML><!--comment1--><TEAM>Giants</TEAM><CITY>San Francisco</CITY><!--comment2--></XML>",
|
||||
(xml3.toString()) );
|
||||
|
||||
|
||||
// c) two attributes { DontEnum, DontDelete }
|
||||
// !!@
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,7 @@
|
|||
XML.ignoreComments PASSED!
|
||||
XML.ignoreComments = false, XML.ignoreComments PASSED!
|
||||
XML.ignoreComments = true, XML.ignoreComments PASSED!
|
||||
MYXML = new XML(thisXML), MYXML.toString() PASSED!
|
||||
MYXML = new XML(thisXML), MYXML.toString() with ignoreComemnts=false PASSED!
|
||||
xml2 = new XML(MYXML), xml2.toString() PASSED!
|
||||
xml3 = new XML(MYXML), xml3.toString() PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,140 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.3 - XML.ignoreProcessingInstructions");
|
||||
|
||||
// We set this to false so we can more easily compare string output
|
||||
XML.prettyPrinting = false;
|
||||
|
||||
// xml string with processing instructions
|
||||
var xmlDoc = "<?xml version=\"1.0\"?><XML><?xml-stylesheet href=\"classic.xsl\" type=\"text/xml\"?><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>"
|
||||
|
||||
// a) value of ignoreProcessingInstructions
|
||||
Assert.expectEq ("XML.ignoreProcessingInstructions", true, (XML.ignoreProcessingInstructions));
|
||||
Assert.expectEq( "XML.ignoreProcessingInstructions = false, XML.ignoreProcessingInstructions", false, (XML.ignoreProcessingInstructions = false, XML.ignoreProcessingInstructions));
|
||||
Assert.expectEq( "XML.ignoreProcessingInstructions = true, XML.ignoreProcessingInstructions", true, (XML.ignoreProcessingInstructions = true, XML.ignoreProcessingInstructions));
|
||||
|
||||
// b) if ignoreProcessingInstructions is true, XML processing instructions are ignored when construction the new XML objects
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString()", "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>",
|
||||
(XML.ignoreProcessingInstructions = true, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
// !!@ note that the "<?xml version=\"1.0\"?>" tag magically disappeared.
|
||||
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString() with ignoreProcessingInstructions=false",
|
||||
"<XML><?xml-stylesheet href=\"classic.xsl\" type=\"text/xml\"?><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>",
|
||||
(XML.ignoreProcessingInstructions = false, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
|
||||
// If ignoreProcessingInstructions is true, XML constructor from another XML node ignores processing instructions
|
||||
XML.ignoreProcessingInstructions = false;
|
||||
var MYXML = new XML(xmlDoc); // this XML node has processing instructions
|
||||
XML.ignoreProcessingInstructions = true;
|
||||
var xml2 = new XML(MYXML); // this XML tree should not have processing instructions
|
||||
Assert.expectEq( "xml2 = new XML(MYXML), xml2.toString()", "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>",
|
||||
(xml2.toString()) );
|
||||
XML.ignoreProcessingInstructions = false;
|
||||
var xml3 = new XML(MYXML); // this XML tree will have processing instructions
|
||||
Assert.expectEq( "xml3 = new XML(MYXML), xml3.toString()",
|
||||
"<XML><?xml-stylesheet href=\"classic.xsl\" type=\"text/xml\"?><TEAM>Giants</TEAM><CITY>San Francisco</CITY></XML>",
|
||||
(xml3.toString()) );
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,7 @@
|
|||
XML.ignoreProcessingInstructions PASSED!
|
||||
XML.ignoreProcessingInstructions = false, XML.ignoreProcessingInstructions PASSED!
|
||||
XML.ignoreProcessingInstructions = true, XML.ignoreProcessingInstructions PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.toString() PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.toString() with ignoreProcessingInstructions=false PASSED!
|
||||
xml2 = new XML(MYXML), xml2.toString() PASSED!
|
||||
xml3 = new XML(MYXML), xml3.toString() PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,152 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.4 - XML.ignoreWhitespace");
|
||||
|
||||
// We set this to false so we can more easily compare string output
|
||||
XML.prettyPrinting = false;
|
||||
|
||||
// xml doc with white space
|
||||
var xmlDoc = "<XML> <TEAM>Giants</TEAM>\u000D<CITY>San\u0020Francisco</CITY>\u000A<SPORT>Baseball</SPORT>\u0009</XML>"
|
||||
|
||||
|
||||
// a) value of ignoreWhitespace
|
||||
Assert.expectEq( "XML.ignoreWhitespace = false, XML.ignoreWhitespace", false, (XML.ignoreWhitespace = false, XML.ignoreWhitespace));
|
||||
Assert.expectEq( "XML.ignoreWhitespace = true, XML.ignoreWhitespace", true, (XML.ignoreWhitespace = true, XML.ignoreWhitespace));
|
||||
|
||||
|
||||
// b) whitespace is ignored when true, not ignored when false
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString()", "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY><SPORT>Baseball</SPORT></XML>",
|
||||
(XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString() with ignoreWhitespace=false",
|
||||
"<XML> <TEAM>Giants</TEAM>\u000D<CITY>San\u0020Francisco</CITY>\u000A<SPORT>Baseball</SPORT>\u0009</XML>",
|
||||
(XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
// c) whitespace characters
|
||||
// tab
|
||||
xmlDoc = "<a>\t<b>tab</b></a>";
|
||||
Assert.expectEq( "XML with tab and XML.ignoreWhiteSpace = true", "<a><b>tab</b></a>",
|
||||
(XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
Assert.expectEq( "XML with tab and XML.ignoreWhiteSpace = false", "<a>\t<b>tab</b></a>",
|
||||
(XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
// new line
|
||||
xmlDoc = "<a>\n<b>\n\ntab</b>\n</a>";
|
||||
Assert.expectEq( "XML with new line and XML.ignoreWhiteSpace = true", "<a><b>tab</b></a>",
|
||||
(XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
xmlDoc = "<a>\r\n<b>tab</b>\r\n</a>";
|
||||
Assert.expectEq( "XML with new line and XML.ignoreWhiteSpace = false", "<a>\r\n<b>tab</b>\r\n</a>",
|
||||
(XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
// d) attributes
|
||||
|
||||
xmlDoc = "<a><b attr=\"1 2\">tab</b></a>";
|
||||
Assert.expectEq( "new XML(\"<a><a><b attr='1 2'>tab</b></a>\")", "<a><b attr=\"1 2\">tab</b></a>",
|
||||
(XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
Assert.expectEq( "new XML(\"<a><a><b attr='1 2'>tab</b></a>\")", "<a><b attr=\"1 2\">tab</b></a>",
|
||||
(XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() ));
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,10 @@
|
|||
XML.ignoreWhitespace = false, XML.ignoreWhitespace PASSED!
|
||||
XML.ignoreWhitespace = true, XML.ignoreWhitespace PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.toString() PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.toString() with ignoreWhitespace=false PASSED!
|
||||
XML with tab and XML.ignoreWhiteSpace = true PASSED!
|
||||
XML with tab and XML.ignoreWhiteSpace = false PASSED!
|
||||
XML with new line and XML.ignoreWhiteSpace = true PASSED!
|
||||
XML with new line and XML.ignoreWhiteSpace = false PASSED!
|
||||
new XML("<a><a><b attr='1 2'>tab</b></a>") PASSED!
|
||||
new XML("<a><a><b attr='1 2'>tab</b></a>") PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,129 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.5 - XML.prettyPrinting");
|
||||
|
||||
// xml doc
|
||||
var xmlDoc = "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY><SPORT>Baseball</SPORT></XML>"
|
||||
|
||||
|
||||
// a) value of prettyPrinting
|
||||
Assert.expectEq( "XML.prettyPrinting = false, XML.prettyPrinting", false, (XML.prettyPrinting = false, XML.prettyPrinting));
|
||||
Assert.expectEq( "XML.prettyPrinting = true, XML.prettyPrinting", true, (XML.prettyPrinting = true, XML.prettyPrinting));
|
||||
|
||||
// b) pretty printing
|
||||
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = false; MYOB.toString()",
|
||||
"<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY><SPORT>Baseball</SPORT></XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyPrinting = false, MYOB.toString()));
|
||||
|
||||
// !!@ very simple example of printing output
|
||||
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString()",
|
||||
"<XML>" + NL() + " <TEAM>Giants</TEAM>" + NL() + " <CITY>San Francisco</CITY>" + NL() + " <SPORT>Baseball</SPORT>" + NL() + "</XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyPrinting = true, MYOB.toString()));
|
||||
|
||||
|
||||
// c) attributes
|
||||
|
||||
// TODO
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,4 @@
|
|||
XML.prettyPrinting = false, XML.prettyPrinting PASSED!
|
||||
XML.prettyPrinting = true, XML.prettyPrinting PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyPrinting = false; MYOB.toString() PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString() PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,153 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.6 - XML.prettyIndent");
|
||||
|
||||
// xml doc
|
||||
XML.prettyPrinting = true;
|
||||
var xmlDoc = "<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY><SPORT>Baseball</SPORT></XML>"
|
||||
|
||||
|
||||
// a) value of prettyIndent
|
||||
Assert.expectEq( "XML.prettyIndent = 4, XML.prettyIndent", 4, (XML.prettyIndent = 4, XML.prettyIndent));
|
||||
Assert.expectEq( "XML.prettyIndent = 2, XML.prettyIndent", 2, (XML.prettyIndent = 2, XML.prettyIndent));
|
||||
Assert.expectEq( "XML.prettyIndent = -1, XML.prettyIndent", -1, (XML.prettyIndent = -1, XML.prettyIndent));
|
||||
|
||||
// b) pretty printing
|
||||
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIndent = 2; MYOB.toString()",
|
||||
"<XML>" + NL() + " <TEAM>Giants</TEAM>" + NL() + " <CITY>San Francisco</CITY>" + NL() + " <SPORT>Baseball</SPORT>" + NL() + "</XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyIndent = 2, MYOB.toString()));
|
||||
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIdent = 4; MYOB.toString()",
|
||||
"<XML>" + NL() + " <TEAM>Giants</TEAM>" + NL() + " <CITY>San Francisco</CITY>" + NL() + " <SPORT>Baseball</SPORT>" + NL() + "</XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyIndent = 4, MYOB.toString()));
|
||||
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIndent = 1; MYOB.toString()",
|
||||
"<XML>" + NL() + " <TEAM>Giants</TEAM>" + NL() + " <CITY>San Francisco</CITY>" + NL() + " <SPORT>Baseball</SPORT>" + NL() + "</XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyIndent = 1, MYOB.toString()));
|
||||
|
||||
// !!@ bad value causes pretty printing to be disabled
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIndent = -5; MYOB.toString()",
|
||||
"<XML><TEAM>Giants</TEAM><CITY>San Francisco</CITY><SPORT>Baseball</SPORT></XML>",
|
||||
//"<XML>" + NL() + " <TEAM>Giants</TEAM>" + NL() + " <CITY>San Francisco</CITY>" + NL() + " <SPORT>Baseball</SPORT>" + NL() + "</XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyIndent = -5, MYOB.toString()));
|
||||
|
||||
|
||||
|
||||
// !!@ very simple example of printing output
|
||||
XML.prettyPrinting = true;
|
||||
XML.prettyIndent = 10;
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString()",
|
||||
"<XML>" + NL() + " <TEAM>Giants</TEAM>" + NL() + " <CITY>San Francisco</CITY>" + NL() + " <SPORT>Baseball</SPORT>" + NL() + "</XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyPrinting = true, MYOB.toString()));
|
||||
|
||||
|
||||
// d) attributes
|
||||
|
||||
XML.prettyIndent = 5;
|
||||
xmlDoc = "<XML><TEAM attr1=\"attr\" attr2=\"hi\">Giants</TEAM><CITY>San Francisco</CITY><SPORT>Baseball</SPORT></XML>"
|
||||
Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString()",
|
||||
"<XML>" + NL() + " <TEAM attr1=\"attr\" attr2=\"hi\">Giants</TEAM>" + NL() + " <CITY>San Francisco</CITY>" + NL() + " <SPORT>Baseball</SPORT>" + NL() + "</XML>",
|
||||
(MYOB = new XML(xmlDoc), XML.prettyPrinting = true, MYOB.toString()));
|
||||
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,9 @@
|
|||
XML.prettyIndent = 4, XML.prettyIndent PASSED!
|
||||
XML.prettyIndent = 2, XML.prettyIndent PASSED!
|
||||
XML.prettyIndent = -1, XML.prettyIndent PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyIndent = 2; MYOB.toString() PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyIdent = 4; MYOB.toString() PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyIndent = 1; MYOB.toString() PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyIndent = -5; MYOB.toString() PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString() PASSED!
|
||||
MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString() PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,149 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.7 - XML.settings");
|
||||
|
||||
// xmlDoc
|
||||
|
||||
var settings = XML.settings();
|
||||
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
XML.ignoreComments = false;
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
XML.ignoreProcessingInstructions = false;
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
XML.ignoreWhitespace = false;
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
XML.prettyPrinting = false;
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
XML.prettyIndent = 4;
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) );
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,30 @@
|
|||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,183 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.8 - XML.setSettings(settings)");
|
||||
|
||||
// a) called with a settings object
|
||||
var settings = XML.settings();
|
||||
|
||||
settings.ignoreComments = false;
|
||||
settings.ignoreProcessingInstructions = false;
|
||||
settings.ignoreWhitespace = false;
|
||||
settings.prettyPrinting = false;
|
||||
settings.prettyIndent = 4;
|
||||
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
XML.setSettings (settings);
|
||||
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) );
|
||||
|
||||
// setting null restores defaults
|
||||
XML.setSettings (null);
|
||||
|
||||
Assert.expectEq( "XML.settings(null); XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings(null); XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings(null); XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings(null); XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings(null); XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
XML.setSettings (settings);
|
||||
// does setting a bogus value restore defaults? No.
|
||||
XML.setSettings ([1, 2, 3, 4]);
|
||||
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) );
|
||||
|
||||
// does setting a bogus value restore defaults? No.
|
||||
XML.setSettings (5);
|
||||
|
||||
Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) );
|
||||
|
||||
// does setting a bogus value restore defaults? No.
|
||||
XML.setSettings ("");
|
||||
|
||||
Assert.expectEq( "XML.setSettings (\"\"); XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.setSettings (\"\"); XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.setSettings (\"\"); XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.setSettings (\"\"); XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.setSettings (\"\"); XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) );
|
||||
|
||||
// this restores defaults
|
||||
XML.setSettings (undefined);
|
||||
|
||||
Assert.expectEq( "XML.setSettings (undefined); XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.setSettings (undefined); XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.setSettings (undefined); XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.setSettings (undefined); XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.setSettings (undefined); XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
// this restore defaults
|
||||
XML.setSettings (settings);
|
||||
XML.setSettings ();
|
||||
|
||||
Assert.expectEq( "XML.setSettings (); XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) );
|
||||
Assert.expectEq( "XML.setSettings (); XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.setSettings (); XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.setSettings (); XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) );
|
||||
Assert.expectEq( "XML.setSettings (); XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) );
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,40 @@
|
|||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings(null); XML.settings().ignoreComments; PASSED!
|
||||
XML.settings(null); XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings(null); XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings(null); XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings(null); XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.settings().ignoreComments; PASSED!
|
||||
XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.settings().prettyPrinting; PASSED!
|
||||
XML.settings().prettyIndent; PASSED!
|
||||
XML.setSettings (""); XML.settings().ignoreComments; PASSED!
|
||||
XML.setSettings (""); XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.setSettings (""); XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.setSettings (""); XML.settings().prettyPrinting; PASSED!
|
||||
XML.setSettings (""); XML.settings().prettyIndent; PASSED!
|
||||
XML.setSettings (undefined); XML.settings().ignoreComments; PASSED!
|
||||
XML.setSettings (undefined); XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.setSettings (undefined); XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.setSettings (undefined); XML.settings().prettyPrinting; PASSED!
|
||||
XML.setSettings (undefined); XML.settings().prettyIndent; PASSED!
|
||||
XML.setSettings (); XML.settings().ignoreComments; PASSED!
|
||||
XML.setSettings (); XML.settings().ignoreProcessingInstructions; PASSED!
|
||||
XML.setSettings (); XML.settings().ignoreWhitespace; PASSED!
|
||||
XML.setSettings (); XML.settings().prettyPrinting; PASSED!
|
||||
XML.setSettings (); XML.settings().prettyIndent; PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,133 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.3.9 - XML.defaultSettings()");
|
||||
|
||||
Assert.expectEq( "settings = XML.defaultSettings(), settings.ignoreComments", true,
|
||||
(settings = XML.defaultSettings(), settings.ignoreComments) );
|
||||
Assert.expectEq( "settings = XML.defaultSettings(), settings.ignoreProcessingInstructions", true,
|
||||
(settings = XML.defaultSettings(), settings.ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "settings = XML.defaultSettings(), settings.ignoreWhitespace", true,
|
||||
(settings = XML.defaultSettings(), settings.ignoreWhitespace) );
|
||||
Assert.expectEq( "settings = XML.defaultSettings(), settings.prettyPrinting", true,
|
||||
(settings = XML.defaultSettings(), settings.prettyPrinting) );
|
||||
Assert.expectEq( "settings = XML.defaultSettings(), settings.prettyIndent", 2,
|
||||
(settings = XML.defaultSettings(), settings.prettyIndent) );
|
||||
|
||||
var tempSettings = XML.settings();
|
||||
tempSettings.ignoreComments = false;
|
||||
tempSettings.ignoreProcessingInstructions = false;
|
||||
tempSettings.ignoreWhitespace = false;
|
||||
tempSettings.prettyPrinting = false;
|
||||
tempSettings.prettyIndent = 4;
|
||||
|
||||
Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreComments", true,
|
||||
(XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreComments) );
|
||||
Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreProcessingInstructions", true,
|
||||
(XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreProcessingInstructions) );
|
||||
Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreWhitespace", true,
|
||||
(XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreWhitespace) );
|
||||
Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyPrinting", true,
|
||||
(XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyPrinting) );
|
||||
Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyIndent", 2,
|
||||
(XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyIndent) );
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,10 @@
|
|||
settings = XML.defaultSettings(), settings.ignoreComments PASSED!
|
||||
settings = XML.defaultSettings(), settings.ignoreProcessingInstructions PASSED!
|
||||
settings = XML.defaultSettings(), settings.ignoreWhitespace PASSED!
|
||||
settings = XML.defaultSettings(), settings.prettyPrinting PASSED!
|
||||
settings = XML.defaultSettings(), settings.prettyIndent PASSED!
|
||||
XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreComments PASSED!
|
||||
XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreProcessingInstructions PASSED!
|
||||
XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreWhitespace PASSED!
|
||||
XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyPrinting PASSED!
|
||||
XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyIndent PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.4.1 - XML Constructor");
|
||||
|
||||
Assert.expectEq( "XML.prototype.constructor == XML", true, XML.prototype.constructor == XML);
|
||||
Assert.expectEq( "XML.prototype.constructor === XML", true, XML.prototype.constructor === XML);
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,2 @@
|
|||
XML.prototype.constructor == XML PASSED!
|
||||
XML.prototype.constructor === XML PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_ticks = 1
|
|
@ -0,0 +1,147 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.4.10 - XML contains()");
|
||||
|
||||
//TEST(1, true, XML.prototype.hasOwnProperty("contains"));
|
||||
|
||||
emps =
|
||||
<employees>
|
||||
<employee id="0"><name>Jim</name><age>25</age></employee>
|
||||
<employee id="1"><name>Joe</name><age>20</age></employee>
|
||||
</employees>;
|
||||
|
||||
TEST(2, true, emps.contains(emps));
|
||||
|
||||
var xmlDoc = "<MLB><Team>Giants</Team><City>San Francisco</City><Team>Padres</Team><City>San Diego</City></MLB>";
|
||||
|
||||
// same object, returns true
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.contains(MYMXL)", true,
|
||||
(MYXML = new XML(xmlDoc), MYXML.contains(MYXML)) );
|
||||
|
||||
// duplicated object, returns true
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.contains(MYMXL.copy())", true,
|
||||
(MYXML = new XML(xmlDoc), MYXML.contains(MYXML.copy())) );
|
||||
|
||||
// identical objects, returns true
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML.contains(MYMXL2)", true,
|
||||
(MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML.contains(MYXML2)) );
|
||||
|
||||
// identical objects, returns true
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.contains(MYMXL)", true,
|
||||
(MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.contains(MYXML)) );
|
||||
|
||||
// slightly different objects, returns false
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.foo = 'bar', MYXML.contains(MYMXL2)", false,
|
||||
(MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.foo = 'bar', MYXML.contains(MYXML2)) );
|
||||
|
||||
// slightly different objects #2, returns false
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.Team[0].foo = 'bar', MYXML.contains(MYMXL2)", false,
|
||||
(MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.Team[0].foo = 'bar', MYXML.contains(MYXML2)) );
|
||||
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.Team[0].contains('Giants')", false,
|
||||
(MYXML = new XML(xmlDoc), MYXML.Team[0].contains('Giants')) );
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.Team[1].contains('Giants')", false,
|
||||
(MYXML = new XML(xmlDoc), MYXML.Team[1].contains('Giants')) );
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.City.contains('Giants')", false,
|
||||
(MYXML = new XML(xmlDoc), MYXML.City.contains('Giants')) );
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,10 @@
|
|||
2 PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.contains(MYMXL) PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.contains(MYMXL.copy()) PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML.contains(MYMXL2) PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.contains(MYMXL) PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.foo = 'bar', MYXML.contains(MYMXL2) PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.Team[0].foo = 'bar', MYXML.contains(MYMXL2) PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.Team[0].contains('Giants') PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.Team[1].contains('Giants') PASSED!
|
||||
MYXML = new XML(xmlDoc), MYXML.City.contains('Giants') PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
|
@ -0,0 +1,169 @@
|
|||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
package {
|
||||
public class Test {}
|
||||
}
|
||||
|
||||
import com.adobe.test.Assert;
|
||||
|
||||
function START(summary)
|
||||
{
|
||||
// print out bugnumber
|
||||
|
||||
/*if ( BUGNUMBER ) {
|
||||
writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
|
||||
}*/
|
||||
XML.setSettings (null);
|
||||
testcases = new Array();
|
||||
|
||||
// text field for results
|
||||
tc = 0;
|
||||
/*this.addChild ( tf );
|
||||
tf.x = 30;
|
||||
tf.y = 50;
|
||||
tf.width = 200;
|
||||
tf.height = 400;*/
|
||||
|
||||
//_print(summary);
|
||||
var summaryParts = summary.split(" ");
|
||||
//_print("section: " + summaryParts[0] + "!");
|
||||
//fileName = summaryParts[0];
|
||||
|
||||
}
|
||||
|
||||
function TEST(section, expected, actual)
|
||||
{
|
||||
AddTestCase(section, expected, actual);
|
||||
}
|
||||
|
||||
|
||||
function TEST_XML(section, expected, actual)
|
||||
{
|
||||
var actual_t = typeof actual;
|
||||
var expected_t = typeof expected;
|
||||
|
||||
if (actual_t != "xml") {
|
||||
// force error on type mismatch
|
||||
TEST(section, new XML(), actual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expected_t == "string") {
|
||||
|
||||
TEST(section, expected, actual.toXMLString());
|
||||
} else if (expected_t == "number") {
|
||||
|
||||
TEST(section, String(expected), actual.toXMLString());
|
||||
} else {
|
||||
reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string');
|
||||
}
|
||||
}
|
||||
|
||||
function reportFailure (section, msg)
|
||||
{
|
||||
trace("~FAILURE: " + section + " | " + msg);
|
||||
}
|
||||
|
||||
function AddTestCase( description, expect, actual ) {
|
||||
testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" );
|
||||
}
|
||||
|
||||
function myGetNamespace (obj, ns) {
|
||||
if (ns != undefined) {
|
||||
return obj.namespace(ns);
|
||||
} else {
|
||||
return obj.namespace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function NL()
|
||||
{
|
||||
//return java.lang.System.getProperty("line.separator");
|
||||
return "\n";
|
||||
}
|
||||
|
||||
|
||||
function BUG(arg){
|
||||
// nothing here
|
||||
}
|
||||
|
||||
function END()
|
||||
{
|
||||
//test();
|
||||
}
|
||||
|
||||
START("13.4.4.11 - XML copy()");
|
||||
|
||||
//TEST(1, true, XML.prototype.hasOwnProperty("copy"));
|
||||
|
||||
emps =
|
||||
<employees>
|
||||
<employee id="0"><name>Jim</name><age>25</age></employee>
|
||||
<employee id="1"><name>Joe</name><age>20</age></employee>
|
||||
</employees>;
|
||||
|
||||
correct =
|
||||
<employee id="0"><name>Jim</name><age>25</age></employee>;
|
||||
|
||||
x1 = emps.employee[0].copy();
|
||||
|
||||
TEST(2, undefined, x1.parent());
|
||||
TEST(3, correct, x1);
|
||||
|
||||
// Make sure we're getting a copy, not a ref to orig.
|
||||
emps =
|
||||
<employees>
|
||||
<employee id="0"><fname>Jim</fname><age>25</age></employee>
|
||||
<employee id="1"><fname>Joe</fname><age>20</age></employee>
|
||||
</employees>;
|
||||
|
||||
correct =
|
||||
<employee id="0"><fname>Jim</fname><age>25</age></employee>
|
||||
|
||||
empCopy = emps.employee[0].copy();
|
||||
|
||||
emps.employee[0].fname[0] = "Sally";
|
||||
|
||||
TEST(4, correct, empCopy);
|
||||
|
||||
// Try copying whole XML twice
|
||||
emps =
|
||||
<employees>
|
||||
<employee id="0"><name>Jim</name><age>25</age></employee>
|
||||
<employee id="1"><name>Joe</name><age>20</age></employee>
|
||||
</employees>;
|
||||
|
||||
empCopy = emps.copy();
|
||||
x1 = empCopy.copy();
|
||||
|
||||
TEST(5, x1, emps);
|
||||
|
||||
XML.prettyPrinting = false;
|
||||
var xmlDoc = "<MLB><Team>Giants</Team><City>San Francisco</City><Team>Padres</Team><City>San Diego</City></MLB>";
|
||||
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), XMLCOPY = MYXML.copy()", xmlDoc,
|
||||
(MYXML = new XML(xmlDoc), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) );
|
||||
Assert.expectEq( "MYXML = new XML(null), XMLCOPY = MYXML.copy()", "",
|
||||
(MYXML = new XML(null), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) );
|
||||
Assert.expectEq( "MYXML = new XML(undefined), XMLCOPY = MYXML.copy()", MYXML.toString(),
|
||||
(MYXML = new XML(undefined), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) );
|
||||
Assert.expectEq( "MYXML = new XML(), XMLCOPY = MYXML.copy()", MYXML.toString(),
|
||||
(MYXML = new XML(), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) );
|
||||
Assert.expectEq( "MYXML = new XML(xmlDoc), XMLCOPY = MYXML.Team.copy()", "<Team>Giants</Team>" + NL() + "<Team>Padres</Team>",
|
||||
(MYXML = new XML(xmlDoc), XMLCOPY = MYXML.Team.copy(), XMLCOPY.toString()) );
|
||||
|
||||
// Make sure it's a copy
|
||||
var MYXML = new XML(xmlDoc);
|
||||
var MYXML2 = MYXML.copy();
|
||||
Assert.expectEq ("MYXML == MYXML.copy()", true, (MYXML == MYXML.copy()));
|
||||
MYXML2.foo = "bar";
|
||||
Assert.expectEq ("MYXML == MYXML2 where MYXML2 is a copy that has been changed", false, (MYXML == MYXML2));
|
||||
|
||||
END();
|
|
@ -0,0 +1,13 @@
|
|||
<flex-config>
|
||||
<compiler>
|
||||
<source-path>
|
||||
<path-element>.</path-element>
|
||||
<path-element>../../../lib</path-element>
|
||||
</source-path>
|
||||
<debug>false</debug>
|
||||
<omit-trace-statements>false</omit-trace-statements>
|
||||
<show-actionscript-warnings>false</show-actionscript-warnings>
|
||||
<strict>false</strict>
|
||||
</compiler>
|
||||
<output>test.swf</output>
|
||||
</flex-config>
|
|
@ -0,0 +1,11 @@
|
|||
2 PASSED!
|
||||
3 PASSED!
|
||||
4 PASSED!
|
||||
5 PASSED!
|
||||
MYXML = new XML(xmlDoc), XMLCOPY = MYXML.copy() PASSED!
|
||||
MYXML = new XML(null), XMLCOPY = MYXML.copy() PASSED!
|
||||
MYXML = new XML(undefined), XMLCOPY = MYXML.copy() PASSED!
|
||||
MYXML = new XML(), XMLCOPY = MYXML.copy() PASSED!
|
||||
MYXML = new XML(xmlDoc), XMLCOPY = MYXML.Team.copy() PASSED!
|
||||
MYXML == MYXML.copy() PASSED!
|
||||
MYXML == MYXML2 where MYXML2 is a copy that has been changed PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue