Debian Codegraph @

rhino/testsrc/tests/e4x/Regress/regress-301692.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 = 'regress-301692.js';
7
8 var summary = "Function.prototype.toString should not quote XML literals";
9 var BUGNUMBER = 301692;
10 var actual = '';
11 var expect = '';
12
13 printBugNumber(BUGNUMBER);
14 START(summary);
15
16 actual = ToString((function () { return <xml/>; }));
17 expect = 'function () { return <xml/>;}';
18 TEST(1, expect, actual);
19
20 actual = ToString((function () { return <xml></xml>; }));
21 expect = 'function () { return <xml></xml>;}';
22 TEST(2, expect, actual);
23
24 actual = ToString((function () { return <xml><morexml/></xml>; }));
25 expect = 'function () { return <xml><morexml/></xml>;}';
26 TEST(3, expect, actual);
27
28 actual = ToString((function (k) { return <xml>{k}</xml>; }));
29 expect = 'function (k) { return <xml>{k}</xml>;}';
30 TEST(4, expect, actual);
31
32 actual = ToString((function (k) { return <{k}/>; }));
33 expect = 'function (k) { return <{k}/>;}';
34 TEST(5, expect, actual);
35
36 actual = ToString((function (k) { return <{k}>{k}</{k}>; }));
37 expect = 'function (k) { return <{k}>{k}</{k}>;}';
38 TEST(6, expect, actual);
39
40 actual = ToString((function (k) { return <{k}
41 {k}={k} {"k"}={k + "world"}><{k + "k"}/></{k}>; }));
42 expect = 'function (k) ' +
43 '{ return <{k} {k}={k} {"k"}={k + "world"}><{k + "k"}/></{k}>;}';
44 TEST(7, expect, actual);
45
46 END();
47
48 function ToString(f)
49 {
50 return f.toString().replace(/\n/g, '').replace(/[ ]+/g, ' ');
51 }