Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-231518.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 var gTestfile = 'regress-231518.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 231518;
9 var summary = 'decompiler must quote keywords and non-identifier property names';
10 var actual = '';
11 var expect = 'no error';
12 var status;
13 var object;
14 var result;
15
16 printBugNumber(BUGNUMBER);
17 printStatus (summary);
18
19
20 if (typeof uneval != 'undefined')
21 {
22 status = inSection(1) + ' eval(uneval({"if": false}))';
23
24 try
25 {
26 object = {'if': false };
27 result = uneval(object);
28 printStatus('uneval returns ' + result);
29 eval(result);
30 actual = 'no error';
31 }
32 catch(e)
33 {
34 actual = 'error';
35 }
36
37 reportCompare(expect, actual, status);
38
39 status = inSection(2) + ' eval(uneval({"if": "then"}))';
40
41 try
42 {
43 object = {'if': "then" };
44 result = uneval(object);
45 printStatus('uneval returns ' + result);
46 eval(result);
47 actual = 'no error';
48 }
49 catch(e)
50 {
51 actual = 'error';
52 }
53
54 reportCompare(expect, actual, status);
55
56 status = inSection(3) + ' eval(uneval(f))';
57
58 try
59 {
60 result = uneval(f);
61 printStatus('uneval returns ' + result);
62 eval(result);
63 actual = 'no error';
64 }
65 catch(e)
66 {
67 actual = 'error';
68 }
69
70 reportCompare(expect, actual, status);
71
72 status = inSection(2) + ' eval(uneval(g))';
73
74 try
75 {
76 result = uneval(g);
77 printStatus('uneval returns ' + result);
78 eval(result);
79 actual = 'no error';
80 }
81 catch(e)
82 {
83 actual = 'error';
84 }
85
86 reportCompare(expect, actual, status);
87 }
88
89 function f()
90 {
91 var obj = new Object();
92
93 obj['name'] = 'Just a name';
94 obj['if'] = false;
95 obj['some text'] = 'correct';
96 }
97
98 function g()
99 {
100 return {'if': "then"};
101 }
102