Debian Codegraph @

rhino/testsrc/jstests/stringify-e4x-replacer.jstest

raw
1 // Ensure that a stringify replacer function gets a chance to do something sane with E4X XML object
2
3 var e4x = <xxx/>;
4 var expected = JSON.stringify(e4x.toXMLString());
5 try {
6 var actual = JSON.stringify(e4x, function(key, value) {
7 return ((typeof value) === "xml") ? value.toXMLString() : value;
8 });
9 } catch (ud) {
10 throw "JSON.stringify(<xxx/>, replacer) threw an Exception"
11 }
12 if (actual !== expected) {
13 throw "Expected '" + expected + "', got '" + actual + "'";
14 }
15
16 "success";