tests: Port avmplus e4x TypeConversion tests
This commit is contained in:
parent
068a4b38ac
commit
f97559066b
|
@ -0,0 +1,143 @@
|
||||||
|
/* -*- 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("bug153363 - XML.toString");
|
||||||
|
|
||||||
|
var myxml = <order xmlns:x='x'>
|
||||||
|
<item id='1' xmlns:x='x2'>
|
||||||
|
<menuName xmlns:x='x'>burger</menuName>
|
||||||
|
<price>3.95</price>
|
||||||
|
</item>
|
||||||
|
</order>;
|
||||||
|
|
||||||
|
var expected_results1:String = <order xmlns:x='x'>
|
||||||
|
<item id='1' xmlns:x='x2'>
|
||||||
|
<menuName xmlns:x='x'>burger</menuName>
|
||||||
|
<price>3.95</price>
|
||||||
|
</item>
|
||||||
|
</order>
|
||||||
|
|
||||||
|
TEST(1,expected_results1,myxml.toString());
|
||||||
|
|
||||||
|
var myxml2 = <order>
|
||||||
|
<item id="1">
|
||||||
|
<menuName xmlns:x="x" x:foo='10'>burger</menuName>
|
||||||
|
</item>
|
||||||
|
<item id="2">
|
||||||
|
<menuName xmlns:x="x" x:foo='20'>salad</menuName>
|
||||||
|
</item>
|
||||||
|
</order>;
|
||||||
|
|
||||||
|
var expected_results2:String = <order>
|
||||||
|
<item id="1">
|
||||||
|
<menuName xmlns:x="x" x:foo='10'>burger</menuName>
|
||||||
|
</item>
|
||||||
|
<item id="2">
|
||||||
|
<menuName xmlns:x="x" x:foo='20'>salad</menuName>
|
||||||
|
</item>
|
||||||
|
</order>;
|
||||||
|
|
||||||
|
TEST(2,expected_results2,myxml2.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,2 @@
|
||||||
|
1 PASSED!
|
||||||
|
2 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,143 @@
|
||||||
|
/* -*- 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("bug153363_2 - XML.toXMLString");
|
||||||
|
|
||||||
|
var myxml = <order xmlns:x='x'>
|
||||||
|
<item id='1' xmlns:x='x2'>
|
||||||
|
<menuName xmlns:x='x'>burger</menuName>
|
||||||
|
<price>3.95</price>
|
||||||
|
</item>
|
||||||
|
</order>;
|
||||||
|
|
||||||
|
var expected_results1:String = <order xmlns:x='x'>
|
||||||
|
<item id='1' xmlns:x='x2'>
|
||||||
|
<menuName xmlns:x='x'>burger</menuName>
|
||||||
|
<price>3.95</price>
|
||||||
|
</item>
|
||||||
|
</order>
|
||||||
|
|
||||||
|
TEST(1,expected_results1,myxml.toXMLString());
|
||||||
|
|
||||||
|
var myxml2 = <order>
|
||||||
|
<item id="1">
|
||||||
|
<menuName xmlns:x="x" x:foo='10'>burger</menuName>
|
||||||
|
</item>
|
||||||
|
<item id="2">
|
||||||
|
<menuName xmlns:x="x" x:foo='20'>salad</menuName>
|
||||||
|
</item>
|
||||||
|
</order>;
|
||||||
|
|
||||||
|
var expected_results2:String = <order>
|
||||||
|
<item id="1">
|
||||||
|
<menuName xmlns:x="x" x:foo='10'>burger</menuName>
|
||||||
|
</item>
|
||||||
|
<item id="2">
|
||||||
|
<menuName xmlns:x="x" x:foo='20'>salad</menuName>
|
||||||
|
</item>
|
||||||
|
</order>;
|
||||||
|
|
||||||
|
TEST(2,expected_results2,myxml2.toXMLString());
|
||||||
|
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
1 PASSED!
|
||||||
|
2 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,127 @@
|
||||||
|
/* -*- 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("10.1.1 - XML.toString");
|
||||||
|
|
||||||
|
order =
|
||||||
|
<order>
|
||||||
|
<customer>
|
||||||
|
<firstname>John</firstname>
|
||||||
|
<lastname>Doe</lastname>
|
||||||
|
</customer>
|
||||||
|
<item>
|
||||||
|
<description>Big Screen Television</description>
|
||||||
|
<price>1299.99</price>
|
||||||
|
<quantity>1</quantity>
|
||||||
|
</item>
|
||||||
|
</order>;
|
||||||
|
|
||||||
|
the_name = order.customer.firstname + " " + order.customer.lastname;
|
||||||
|
|
||||||
|
TEST(1, "John Doe", the_name);
|
||||||
|
|
||||||
|
total = order.item.price * order.item.quantity;
|
||||||
|
|
||||||
|
TEST(2, 1299.99, total);
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
1 PASSED!
|
||||||
|
2 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,136 @@
|
||||||
|
/* -*- 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("10.1.2 - XMLList.toString");
|
||||||
|
|
||||||
|
// One XML object
|
||||||
|
|
||||||
|
var x1 = new XML("<a>A</a>");
|
||||||
|
var x_ = x1.toString();
|
||||||
|
var y1 = "A";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToString(XMLList:one XML object) :", true, (x_==y1) );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
x1 = new XML("<!-- [[Class]]='comment' -->");
|
||||||
|
x_ = x1.toString();
|
||||||
|
y1 = "";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToString(XMLList:one XML object, [[Class]]='comment') :", true, (x_==y1) );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
x1 = new XML("<? xm-xsl-param name='Name' value='Value' ?>");
|
||||||
|
x_ = x1.toString();
|
||||||
|
y1 = "";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToString(XMLList:one XML object, [[Class]]='processing-instruction') :", true, (x_==y1) );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
XML.prettyPrinting = false;
|
||||||
|
x1 = new XMLList("<a><b>A</b><c>B</c></a><a><b>C</b><c>D</c></a>");
|
||||||
|
x_ = x1.toString();
|
||||||
|
y1 = "<a><b>A</b><c>B</c></a>\n<a><b>C</b><c>D</c></a>";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToString(XMLList:multiple XML objects) :", true, (x_==y1) );
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
ToString(XMLList:one XML object) : PASSED!
|
||||||
|
ToString(XMLList:one XML object, [[Class]]='comment') : PASSED!
|
||||||
|
ToString(XMLList:one XML object, [[Class]]='processing-instruction') : PASSED!
|
||||||
|
ToString(XMLList:multiple XML objects) : PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,142 @@
|
||||||
|
/* -*- 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("10.2.1 - XML.toXMLString");
|
||||||
|
|
||||||
|
// text
|
||||||
|
|
||||||
|
var x1 = new XML("abc & 123");
|
||||||
|
var x0 = x1.toXMLString();
|
||||||
|
var y0 = "abc & 123";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXMLString(text) :", true, (x0==y0) );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
// comment
|
||||||
|
|
||||||
|
x1 = new XML("<x><!-- Hello World --></x>");
|
||||||
|
x0 = x1.toXMLString();
|
||||||
|
y0 = "<x/>";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXMLString(comment) :", true, (x0==y0) );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
// processing instruction
|
||||||
|
|
||||||
|
x1 = new XML("<?xml version='1.0'?><x>i</x>");
|
||||||
|
x0 = x1.toXMLString();
|
||||||
|
y0 = "<x>i</x>";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXMLString(processing-instruction) :", true, (x0==y0) );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
// ToXMLString ( x )
|
||||||
|
|
||||||
|
XML.ignoreWhitespace = true;
|
||||||
|
|
||||||
|
x1 = new XML("<a><b>B</b><c>C</c></a>");
|
||||||
|
|
||||||
|
x0 = x1.toXMLString();
|
||||||
|
y0 = "<a>\n <b>B</b>\n <c>C</c>\n</a>";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXMLString(XML) :", true, (x0==y0) );
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
ToXMLString(text) : PASSED!
|
||||||
|
ToXMLString(comment) : PASSED!
|
||||||
|
ToXMLString(processing-instruction) : PASSED!
|
||||||
|
ToXMLString(XML) : PASSED!
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
||||||
|
num_ticks = 1
|
||||||
|
known_failure = true
|
|
@ -0,0 +1,109 @@
|
||||||
|
/* -*- 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("10.2.1.1 - EscapeElementValue(s)");
|
||||||
|
|
||||||
|
Assert.expectEq( "EscapeElementValue('&') :", "<x>4 & 5</x>", (x1 = new XML("<x>4 & 5</x>"), x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('&') :", "<x>4 & 5</x>", (x1 = new XML("<x>4 & 5</x>"), x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('<') :", "<x>4 < 5</x>", (x1 = new XML("<x>4 < 5</x>"), x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('>') :", "<x>5 > 4</x>", (x1 = new XML("<x>5 > 4</x>"), x1.toXMLString()) );
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
EscapeElementValue('&') : PASSED!
|
||||||
|
EscapeElementValue('&') : PASSED!
|
||||||
|
EscapeElementValue('<') : PASSED!
|
||||||
|
EscapeElementValue('>') : PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,115 @@
|
||||||
|
/* -*- 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("10.2.1.2 - EscapeAttributeValue(s)");
|
||||||
|
|
||||||
|
Assert.expectEq( "EscapeElementValue('\"') :", "<x attr=\"I said "hi"\">hi</x>", (x1 = <x attr='I said "hi"'>hi</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('<') :", "<x attr=\"4 < 5\">b</x>", (x1 = <x attr='4 < 5'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('>') :", "<x attr=\"10 > 9\">b</x>", (x1 = <x attr='10 > 9'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('&') :", "<x attr=\"Tom & Jerry\">b</x>", (x1 = <x attr='Tom & Jerry'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('	') :", "<x attr=\"	\">b</x>", (x1 = <x attr='	'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('
') :", "<x attr=\"
\">b</x>", (x1 = <x attr='
'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('
') :", "<x attr=\"
\">b</x>", (x1 = <x attr='
'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('\u0009') :", "<x attr=\"	\">b</x>", (x1 = <x attr='\u0009'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('\u000A') :", "<x attr=\"
\">b</x>", (x1 = <x attr='\u000A'>b</x>, x1.toXMLString()) );
|
||||||
|
Assert.expectEq( "EscapeElementValue('\u000D') :", "<x attr=\"
\">b</x>", (x1 = <x attr='\u000D'>b</x>, x1.toXMLString()) );
|
||||||
|
|
||||||
|
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,12 @@
|
||||||
|
EscapeElementValue('"') : PASSED!
|
||||||
|
EscapeElementValue('<') : PASSED!
|
||||||
|
EscapeElementValue('>') : PASSED!
|
||||||
|
EscapeElementValue('&') : PASSED!
|
||||||
|
EscapeElementValue('	') : PASSED!
|
||||||
|
EscapeElementValue('
') : PASSED!
|
||||||
|
EscapeElementValue('
') : PASSED!
|
||||||
|
EscapeElementValue(' ') : PASSED!
|
||||||
|
EscapeElementValue('
|
||||||
|
') : PASSED!
|
||||||
|
EscapeElementValue('
|
||||||
|
') : PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,112 @@
|
||||||
|
/* -*- 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("10.2.2 - ToXMLString Applied to the XMLList Type");
|
||||||
|
|
||||||
|
//ToXMLString ( xl )
|
||||||
|
|
||||||
|
var x1 = new XMLList("<a>A</a><b>B</b><c>C</c>");
|
||||||
|
var x_ = x1.toXMLString();
|
||||||
|
var y1 = "<a>A</a>\n<b>B</b>\n<c>C</c>";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXMLString(XMLList) :", true, (x_==y1) );
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
ToXMLString(XMLList) : PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,221 @@
|
||||||
|
/* -*- 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("10.3 - toXML");
|
||||||
|
|
||||||
|
var x1;
|
||||||
|
|
||||||
|
// boolean
|
||||||
|
x1 = new Boolean(true);
|
||||||
|
TEST_XML(1, "true", new XML(x1));
|
||||||
|
|
||||||
|
// number
|
||||||
|
x1 = new Number(123);
|
||||||
|
TEST_XML(2, "123", new XML(x1));
|
||||||
|
|
||||||
|
// String
|
||||||
|
x1 = new String("<alpha><bravo>one</bravo></alpha>");
|
||||||
|
TEST(3, <alpha><bravo>one</bravo></alpha>, new XML(x1));
|
||||||
|
|
||||||
|
// XML
|
||||||
|
x1 = new XML("<alpha><bravo>one</bravo></alpha>");
|
||||||
|
TEST(4, <alpha><bravo>one</bravo></alpha>, new XML(x1));
|
||||||
|
|
||||||
|
// XMLList
|
||||||
|
x1 = new XMLList("<alpha><bravo>one</bravo></alpha>");
|
||||||
|
TEST(5, <alpha><bravo>one</bravo></alpha>, new XML(x1));
|
||||||
|
|
||||||
|
try {
|
||||||
|
x1 = new XMLList(<alpha>one</alpha> + <bravo>two</bravo>);
|
||||||
|
new XML(x1);
|
||||||
|
SHOULD_THROW(6);
|
||||||
|
} catch (ex) {
|
||||||
|
TEST(6, "TypeError", ex.name);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// Undefined
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ToXML(undefined);
|
||||||
|
Assert.expectEq( "ToXML(undefined) :", true, false );
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
Assert.expectEq( "ToXML(undefined) :", true, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Null
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ToXML(null);
|
||||||
|
Assert.expectEq( "ToXML(null) :", true, false );
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
Assert.expectEq( "ToXML(null) :", true, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Boolean
|
||||||
|
|
||||||
|
var xt = "<parent xmlns=''>true</parent>";
|
||||||
|
var xf = "<parent xmlns=''>false</parent>";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXML(true) :", true, (ToXML(true)==xt) );
|
||||||
|
Assert.expectEq( "ToXML(false) :", true, (ToXML(false)==xf) );
|
||||||
|
|
||||||
|
|
||||||
|
// Number
|
||||||
|
|
||||||
|
var xn = "<parent xmlns=''>1234</parent>";
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXML(1234) :", true, (ToXML(1234)==xn) );
|
||||||
|
|
||||||
|
|
||||||
|
// XML
|
||||||
|
|
||||||
|
var x1 = new XML("<a><b>A</b></a>");
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXML(XML) :", true, (ToXML(x1)==x1) );
|
||||||
|
|
||||||
|
|
||||||
|
// XMLList
|
||||||
|
|
||||||
|
x1 = new XML("<a>A</a>");
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXML(XMLList) :", true, (ToXML(x1)=="A") );
|
||||||
|
|
||||||
|
|
||||||
|
// XMLList - XMLList contains more than one property
|
||||||
|
|
||||||
|
x1 = <a>A</a>
|
||||||
|
<b>B</b>
|
||||||
|
<c>C</c>;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ToXML(x);
|
||||||
|
Assert.expectEq( "ToXML(XMLList) :", true, false );
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
Assert.expectEq( "ToXML(XMLList) :", true, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Object
|
||||||
|
|
||||||
|
var a = new Array();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ToXML(a);
|
||||||
|
Assert.expectEq( "ToXML(Object) :", true, false );
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
Assert.expectEq( "ToXML(Object) :", true, true );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
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,6 @@
|
||||||
|
1 PASSED!
|
||||||
|
2 PASSED!
|
||||||
|
3 PASSED!
|
||||||
|
4 PASSED!
|
||||||
|
5 PASSED!
|
||||||
|
6 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -0,0 +1,128 @@
|
||||||
|
/* -*- 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("10.3.1 - toXML applied to String type");
|
||||||
|
|
||||||
|
john = "<employee><name>John</name><age>25</age></employee>";
|
||||||
|
sue = "<employee><name>Sue</name><age>32</age></employee>";
|
||||||
|
tagName = "employees";
|
||||||
|
employees = new XML("<" + tagName + ">" + john + sue + "</" + tagName + ">");
|
||||||
|
|
||||||
|
correct =
|
||||||
|
<employees>
|
||||||
|
<employee><name>John</name><age>25</age></employee>
|
||||||
|
<employee><name>Sue</name><age>32</age></employee>
|
||||||
|
</employees>;
|
||||||
|
|
||||||
|
TEST(1, correct, employees);
|
||||||
|
/*
|
||||||
|
var x = "<a><b>A</b></a>";
|
||||||
|
var x_ = new XML("<a><b>A</b></a>");
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXML(String) :", true, (ToXML(x)==x_) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var xn = new XML(x);
|
||||||
|
|
||||||
|
Assert.expectEq( "ToXML(String) - new XML() :", true, (xn==x_) );
|
||||||
|
*/
|
||||||
|
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,143 @@
|
||||||
|
/* -*- 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("10.4 - toXMLList");
|
||||||
|
|
||||||
|
var xl;
|
||||||
|
|
||||||
|
// null
|
||||||
|
try {
|
||||||
|
xl = null;
|
||||||
|
xl.toString();
|
||||||
|
SHOULD_THROW(1);
|
||||||
|
} catch (ex) {
|
||||||
|
TEST(1, "TypeError", ex.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// number
|
||||||
|
x = new Number(123);
|
||||||
|
TEST(2, "123", new XMLList(x).toXMLString());
|
||||||
|
|
||||||
|
// String
|
||||||
|
x = new String("<alpha><bravo>one</bravo></alpha>");
|
||||||
|
TEST(3, <alpha><bravo>one</bravo></alpha>, new XMLList(x));
|
||||||
|
|
||||||
|
x = new String("<alpha>one</alpha><charlie>two</charlie>");
|
||||||
|
TEST(4, "<alpha>one</alpha>" + "\n" + "<charlie>two</charlie>",
|
||||||
|
new XMLList(x).toXMLString());
|
||||||
|
|
||||||
|
// XML
|
||||||
|
x = new XML(<alpha><bravo>one</bravo></alpha>);
|
||||||
|
TEST(5, <alpha><bravo>one</bravo></alpha>, new XMLList(x));
|
||||||
|
|
||||||
|
x = new XML(<root><alpha><bravo>one</bravo></alpha><charlie>two</charlie></root>);
|
||||||
|
TEST(6, <alpha><bravo>one</bravo></alpha>, new XMLList(x.alpha));
|
||||||
|
|
||||||
|
// XMLList
|
||||||
|
x = new XMLList(<alpha><bravo>one</bravo></alpha>);
|
||||||
|
TEST(7, <alpha><bravo>one</bravo></alpha>, new XMLList(x));
|
||||||
|
|
||||||
|
x = new XMLList(<><alpha>one</alpha><bravo>two</bravo></>);
|
||||||
|
TEST(8, "<alpha>one</alpha>" + "\n" + "<bravo>two</bravo>",
|
||||||
|
new XMLList(x).toXMLString());
|
||||||
|
|
||||||
|
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,8 @@
|
||||||
|
1 PASSED!
|
||||||
|
2 PASSED!
|
||||||
|
3 PASSED!
|
||||||
|
4 PASSED!
|
||||||
|
5 PASSED!
|
||||||
|
6 PASSED!
|
||||||
|
7 PASSED!
|
||||||
|
8 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
|
@ -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;
|
||||||
|
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("10.4.1 - toXMLList Applied to String type");
|
||||||
|
|
||||||
|
var x1, y1, correct;
|
||||||
|
|
||||||
|
x1 =
|
||||||
|
<>
|
||||||
|
<alpha>one</alpha>
|
||||||
|
<bravo>two</bravo>
|
||||||
|
</>;
|
||||||
|
|
||||||
|
TEST(1, "xml", typeof(x1));
|
||||||
|
TEST(2, "<alpha>one</alpha>" + NL() + "<bravo>two</bravo>", x1.toXMLString());
|
||||||
|
|
||||||
|
// Load from another XMLList
|
||||||
|
// Make sure it is copied if it's an XMLList
|
||||||
|
y1 = new XMLList(x1);
|
||||||
|
|
||||||
|
x1 += <charlie>three</charlie>;
|
||||||
|
|
||||||
|
TEST(3, "<alpha>one</alpha>" + NL() + "<bravo>two</bravo>", y1.toXMLString());
|
||||||
|
|
||||||
|
// Load from one XML type
|
||||||
|
x1 = new XMLList(<alpha>one</alpha>);
|
||||||
|
TEST(4, "<alpha>one</alpha>", x1.toXMLString());
|
||||||
|
|
||||||
|
// Load from Anonymous
|
||||||
|
x1 = new XMLList(<><alpha>one</alpha><bravo>two</bravo></>);
|
||||||
|
TEST(5, "<alpha>one</alpha>" + NL() + "<bravo>two</bravo>", x1.toXMLString());
|
||||||
|
|
||||||
|
// Load from Anonymous as string
|
||||||
|
x1 = new XMLList("<alpha>one</alpha><bravo>two</bravo>");
|
||||||
|
TEST(6, "<alpha>one</alpha>" + NL() + "<bravo>two</bravo>", x1.toXMLString());
|
||||||
|
|
||||||
|
// Load from illegal type
|
||||||
|
//x1 = new XMLList("foobar");
|
||||||
|
//ADD(7, "", x);
|
||||||
|
|
||||||
|
John = "<employee><name>John</name><age>25</age></employee>";
|
||||||
|
Sue = "<employee><name>Sue</name><age>32</age></employee>";
|
||||||
|
|
||||||
|
correct =
|
||||||
|
<>
|
||||||
|
<employee><name>John</name><age>25</age></employee>
|
||||||
|
<employee><name>Sue</name><age>32</age></employee>
|
||||||
|
</>;
|
||||||
|
|
||||||
|
var1 = new XMLList(John + Sue);
|
||||||
|
|
||||||
|
TEST(8, correct, var1);
|
||||||
|
|
||||||
|
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 @@
|
||||||
|
1 PASSED!
|
||||||
|
2 PASSED!
|
||||||
|
3 PASSED!
|
||||||
|
4 PASSED!
|
||||||
|
5 PASSED!
|
||||||
|
6 PASSED!
|
||||||
|
8 PASSED!
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
num_ticks = 1
|
Loading…
Reference in New Issue