Skip to content

Commit

Permalink
tests: A simple test for ToXMLString with namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie committed May 30, 2024
1 parent d98e3d9 commit 0b2881c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
23 changes: 23 additions & 0 deletions tests/tests/swfs/avm2/xml_tostring_namespace/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package {
import flash.display.Sprite;
public class Test extends Sprite { }
}

var xml = <root xmlns="http://example.com" xmlns:ns1="http://xxx.com/">
<ns1:foo xmlns:ns2="http://yyy.com/">
<ns2:bar abc="1" ns1:def="2" ns2:ghi="3">bar</ns2:bar>
</ns1:foo>
</root>;

trace("// xml.toXMLString()");
trace(xml.toXMLString());

trace("// xml.child(0).toXMLString()");
trace(xml.child(0).toXMLString());

trace("// xml.child(0).child(0).toXMLString()");
trace(xml.child(0).child(0).toXMLString());

// TODO: Flash invents a prefix ...
// trace("// xml.child(0).child(0).copy().toXMLString()");
// trace(xml.child(0).child(0).copy().toXMLString());
12 changes: 12 additions & 0 deletions tests/tests/swfs/avm2/xml_tostring_namespace/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// xml.toXMLString()
<root xmlns="http://example.com" xmlns:ns1="http://xxx.com/">
<ns1:foo xmlns:ns2="http://yyy.com/">
<ns2:bar abc="1" ns1:def="2" ns2:ghi="3">bar</ns2:bar>
</ns1:foo>
</root>
// xml.child(0).toXMLString()
<ns1:foo xmlns:ns2="http://yyy.com/" xmlns="http://example.com" xmlns:ns1="http://xxx.com/">
<ns2:bar abc="1" ns1:def="2" ns2:ghi="3">bar</ns2:bar>
</ns1:foo>
// xml.child(0).child(0).toXMLString()
<ns2:bar abc="1" ns1:def="2" ns2:ghi="3" xmlns:ns2="http://yyy.com/" xmlns="http://example.com" xmlns:ns1="http://xxx.com/">bar</ns2:bar>
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/xml_tostring_namespace/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_ticks = 1
1 change: 0 additions & 1 deletion tests/tests/swfs/from_avmplus/e4x/XML/e13_4_4_39/test.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true

0 comments on commit 0b2881c

Please sign in to comment.