Skip to content

Commit

Permalink
tests: Test mismatched E4X tags
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie authored and torokati44 committed Jul 8, 2024
1 parent 8768143 commit eec5e90
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 2 deletions.
39 changes: 39 additions & 0 deletions tests/tests/swfs/avm2/xml_mismatched_tag/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package {
import flash.display.Sprite;
public class Test extends Sprite { }
}

var testcases = [
"<a>",
"<a><b>",
"<a></a>",
"<a></a/>",
// TODO: Should be rejected
// "<a></a//>",
"<a></a />",
"<a></a >",
"<a></a\t>",
'<a></a hello="world">',
"<a></b>",
"<a></b/>",
"<a></b//>",
"<a></b >",
"<a></b\t>",
'<a></b hello="world">',
"<a></A>",
"<a></abc>",
// TODO
// "<a></a bc>",
"<root><a></a/><test/></root>",
]

for each (var testcase in testcases) {
trace("input: " + testcase);

try {
var xml = new XML(testcase);
trace("result: " + xml.toXMLString());
} catch (e) {
trace(e);
}
}
37 changes: 37 additions & 0 deletions tests/tests/swfs/avm2/xml_mismatched_tag/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
input: <a>
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a><b>
TypeError: Error #1085: The element type "b" must be terminated by the matching end-tag "</b>".
input: <a></a>
result: <a/>
input: <a></a/>
result: <a/>
input: <a></a />
result: <a/>
input: <a></a >
result: <a/>
input: <a></a >
result: <a/>
input: <a></a hello="world">
result: <a/>
input: <a></b>
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a></b/>
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a></b//>
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a></b >
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a></b >
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a></b hello="world">
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a></A>
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <a></abc>
TypeError: Error #1085: The element type "a" must be terminated by the matching end-tag "</a>".
input: <root><a></a/><test/></root>
result: <root>
<a/>
<test/>
</root>
Binary file added tests/tests/swfs/avm2/xml_mismatched_tag/test.swf
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/xml_mismatched_tag/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_ticks = 1
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true

0 comments on commit eec5e90

Please sign in to comment.