Debian Codegraph @

rhino/testsrc/tests/js1_5/decompilation/regress-346904.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-346904.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 346904;
9 var summary = 'uneval expressions with double negation, negation decrement';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 var f;
25
26 // - --
27 expect =
28 'function () {\n' +
29 ' return - --x;\n' +
30 '}';
31 try
32 {
33 f = eval('(function () { return - --x; })');
34 actual = f + '';
35 compareSource(expect, actual, summary);
36 }
37 catch(ex)
38 {
39 actual = ex + '';
40 reportCompare(expect, actual, summary);
41 }
42
43 // - -
44 expect =
45 'function () {\n' +
46 ' return - - x;\n' +
47 '}';
48 try
49 {
50 f = eval('(function () { return - - x; })');
51 actual = f + '';
52 compareSource(expect, actual, summary);
53 }
54 catch(ex)
55 {
56 actual = ex + '';
57 reportCompare(expect, actual, summary);
58 }
59
60 // ---
61 expect = 'SyntaxError';
62 try
63 {
64 f = eval('(function () { return ---x; })');
65 actual = f + '';
66 compareSource(expect, actual, summary);
67 }
68 catch(ex)
69 {
70 actual = ex.name;
71 reportCompare(expect, actual, summary);
72 }
73
74 // + ++
75 expect =
76 'function () {\n' +
77 ' return + ++x;\n' +
78 '}';
79 try
80 {
81 f = eval('(function () { return + ++x; })');
82 actual = f + '';
83 compareSource(expect, actual, summary);
84 }
85 catch(ex)
86 {
87 actual = ex + '';
88 reportCompare(expect, actual, summary);
89 }
90
91 // + +
92 expect =
93 'function () {\n' +
94 ' return + + x;\n' +
95 '}';
96 try
97 {
98 f = eval('(function () { return + + x; })');
99 actual = f + '';
100 compareSource(expect, actual, summary);
101 }
102 catch(ex)
103 {
104 actual = ex + '';
105 reportCompare(expect, actual, summary);
106 }
107
108 // +++
109
110 expect = 'SyntaxError';
111 try
112 {
113 f = eval('(function () { return +++x; })');
114 actual = f + '';
115 }
116 catch(ex)
117 {
118 actual = ex.name;
119 }
120 reportCompare(expect, actual, summary);
121
122
123 exitFunc ('test');
124 }