| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
gTestsuite = 'e4x'; |
| 8 |
|
| 9 |
if (typeof version != 'undefined') { |
| 10 |
|
| 11 |
|
| 12 |
version(160); |
| 13 |
} |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
function reportFailure (section, msg) |
| 19 |
{ |
| 20 |
msg = inSection(section)+"\n"+msg; |
| 21 |
var lines = msg.split ("\n"); |
| 22 |
for (var i=0; i<lines.length; i++) |
| 23 |
print (FAILED + lines[i]); |
| 24 |
} |
| 25 |
|
| 26 |
function START(summary) |
| 27 |
{ |
| 28 |
SUMMARY = summary; |
| 29 |
printStatus(summary); |
| 30 |
} |
| 31 |
|
| 32 |
function TEST(section, expected, actual) |
| 33 |
{ |
| 34 |
var expected_t = typeof expected; |
| 35 |
var actual_t = typeof actual; |
| 36 |
var output = ""; |
| 37 |
|
| 38 |
SECTION = section; |
| 39 |
EXPECTED = expected; |
| 40 |
ACTUAL = actual; |
| 41 |
|
| 42 |
return reportCompare(expected, actual, inSection(section) + SUMMARY); |
| 43 |
} |
| 44 |
|
| 45 |
function TEST_XML(section, expected, actual) |
| 46 |
{ |
| 47 |
var actual_t = typeof actual; |
| 48 |
var expected_t = typeof expected; |
| 49 |
|
| 50 |
SECTION = section; |
| 51 |
EXPECTED = expected; |
| 52 |
ACTUAL = actual; |
| 53 |
|
| 54 |
if (actual_t != "xml") { |
| 55 |
|
| 56 |
return TEST(section, new XML(), actual); |
| 57 |
} |
| 58 |
|
| 59 |
if (expected_t == "string") { |
| 60 |
return TEST(section, expected, actual.toXMLString()); |
| 61 |
} |
| 62 |
|
| 63 |
if (expected_t == "number") { |
| 64 |
return TEST(section, String(expected), actual.toXMLString()); |
| 65 |
} |
| 66 |
|
| 67 |
throw section + ": Bad TEST_XML usage: type of expected is " + |
| 68 |
expected_t + ", should be number or string"; |
| 69 |
|
| 70 |
|
| 71 |
return false; |
| 72 |
} |
| 73 |
|
| 74 |
function SHOULD_THROW(section) |
| 75 |
{ |
| 76 |
TEST(section, "exception", "no exception"); |
| 77 |
} |
| 78 |
|
| 79 |
function END() |
| 80 |
{ |
| 81 |
} |
| 82 |
|
| 83 |
if (typeof options == 'function') |
| 84 |
{ |
| 85 |
options('xml'); |
| 86 |
} |