Debian Codegraph @

rhino/testsrc/tests/e4x/decompilation/decompile-xml-escapes.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = 'decompile-xml-escapes.js';
7
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = "352285";
10 var summary = "Decompiler escapes line breaks/backslashes in E4X literals";
11 var actual, expect;
12
13 printBugNumber(BUGNUMBER);
14 START(summary);
15
16 /**************
17 * BEGIN TEST *
18 **************/
19
20 var failed = false;
21
22 function assertCorrectDecompilation(xmlInitializer)
23 {
24 var func = new Function("return " + xmlInitializer);
25 var funcStr = func.toString();
26 if (funcStr.indexOf(xmlInitializer) < 0)
27 throw "'" + funcStr + "' does not contain '" + xmlInitializer + "'!";
28 }
29
30 try
31 {
32 assertCorrectDecompilation("<![CDATA[\\\\]]>");
33 assertCorrectDecompilation("<![CDATA[\n]]>");
34 assertCorrectDecompilation("<![CDATA[foo\nbar\nbaz]]>");
35 assertCorrectDecompilation("<!--f b\nc\n-->");
36 assertCorrectDecompilation("<?f b\n\nc\nc?>");
37 }
38 catch (ex)
39 {
40 failed = ex;
41 }
42
43 expect = false;
44 actual = failed;
45
46 TEST(1, expect, actual);