author | sundar |
Wed, 06 May 2015 20:04:42 +0530 | |
changeset 30394 | 72a59e4dffea |
parent 26067 | b32ccc3a76c9 |
child 33692 | b1e37de33c9d |
permissions | -rw-r--r-- |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
1 |
/* |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
4 |
* |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
8 |
* |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
13 |
* accompanied this code). |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
14 |
* |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
18 |
* |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
21 |
* questions. |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
22 |
*/ |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
23 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
24 |
/** |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
25 |
* JDK-8047369: Add regression tests for passing test cases of JDK-8024971 |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
26 |
* |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
27 |
* @test |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
28 |
* @run |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
29 |
* @option -scripting |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
30 |
*/ |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
31 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
32 |
function makeFuncAndCall(code) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
33 |
Function(code)(); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
34 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
35 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
36 |
function makeFuncExpectError(code, ErrorType) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
37 |
try { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
38 |
makeFuncAndCall(code); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
39 |
} catch (e) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
40 |
if (! (e instanceof ErrorType)) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
41 |
fail(ErrorType.name + " expected, got " + e); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
42 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
43 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
44 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
45 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
46 |
function evalExpectError(code, ErrorType) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
47 |
try { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
48 |
eval(code)(); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
49 |
} catch (e) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
50 |
if (! (e instanceof ErrorType)) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
51 |
fail(ErrorType.name + " expected, got " + e); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
52 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
53 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
54 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
55 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
56 |
function evalExpectValue(code, value) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
57 |
if (eval(code) != value) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
58 |
fail("Expected " + value + " with eval of " + code); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
59 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
60 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
61 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
62 |
makeFuncAndCall("for(x.x in 0) {}"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
63 |
// bug JDK-8047357 |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
64 |
// makeFuncAndCall("switch((null >> x3)) { default: {var x; break ; }\nthrow x; }"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
65 |
makeFuncExpectError("switch(x) { case 8: break; case false: }", ReferenceError); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
66 |
makeFuncAndCall("try { return true; } finally { return false; } "); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
67 |
makeFuncAndCall("({ get 1e81(){} })"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
68 |
makeFuncAndCall("{var x, x3;try { return 0; } finally { return 3/0; } }"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
69 |
makeFuncExpectError("with(x ? 1e81 : (x2.constructor = 0.1)) {}", ReferenceError); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
70 |
makeFuncAndCall("while(x-=1) {var x=0; }"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
71 |
makeFuncAndCall("while((x-=false) && 0) { var x = this; }"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
72 |
makeFuncAndCall("/*infloop*/while(x4-=x) var x, x4 = x1;"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
73 |
makeFuncAndCall("/*infloop*/L:while(x+=null) { this;var x = /x/g ; }"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
74 |
makeFuncAndCall("while((x1|=0.1) && 0) { var x1 = -0, functional; }"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
75 |
makeFuncAndCall("with({}) return (eval(\"arguments\"));"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
76 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
77 |
evalExpectValue(<<CODE |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
78 |
var s = "(function() { return y })()"; |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
79 |
(function() { |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
80 |
with({ y:1 }) |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
81 |
eval(s) |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
82 |
})(); |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
83 |
(function() { |
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
84 |
with({ |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
85 |
get y() { return "get"; } |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
86 |
}) |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
87 |
return eval(s) |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
88 |
})(); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
89 |
CODE, "get"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
90 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
91 |
// bug JDK-8047359 |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
92 |
// evalExpectValue("s = ' '; for (var i=0;i<31;++i) s+=s; s.length", RangeError); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
93 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
94 |
evalExpectValue(<<CODE |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
95 |
function f(o) { |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
96 |
var eval=0; |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
97 |
with({ |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
98 |
get eval() { return o.eval } |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
99 |
}) |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
100 |
return eval("1+2"); |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
101 |
} |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
102 |
f(this); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
103 |
CODE, 3) |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
104 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
105 |
evalExpectValue(<<CODE |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
106 |
function f() { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
107 |
var a=1,e=2; |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
108 |
try { |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
109 |
throw 3 |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
110 |
} catch(e) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
111 |
return + function g(){return eval('a+e')}() |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
112 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
113 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
114 |
f(); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
115 |
CODE, 4); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
116 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
117 |
//evalExpectValue( |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
118 |
// "function f(){var a=1; with({get a(){return false}}) return a}; f()", false); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
119 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
120 |
evalExpectError("function public() {\"use strict\"}", SyntaxError); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
121 |
evalExpectError("function f(public) {\"use strict\"}", SyntaxError); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
122 |
evalExpectError("function f() { switch(x) {} } f()", ReferenceError); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
123 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
124 |
// bug JDK-8047364 |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
125 |
// makeFuncAndCall("L1:try { return } finally { break L1 }"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
126 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
127 |
evalExpectValue(<<CODE |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
128 |
function f() { |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
129 |
function g() { return 0 } |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
130 |
function g() { return 1 } |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
131 |
function g$1() { return 2 } |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
132 |
return g$1() |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
133 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
134 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
135 |
f(); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
136 |
CODE, 2); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
137 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
138 |
evalExpectValue(<<CODE |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
139 |
function f() { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
140 |
function g() {return 0 } |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
141 |
var h = function g() { return 1 }; |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
142 |
function g$1() { return 2 }; |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
143 |
return h() |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
144 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
145 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
146 |
f() |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
147 |
CODE, 1); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
148 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
149 |
evalExpectValue(<<CODE |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
150 |
function f() { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
151 |
var obj = { get ":"() {} } |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
152 |
var desc = Object.getOwnPropertyDescriptor(obj, ":") |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
153 |
return desc.get.name |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
154 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
155 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
156 |
f() |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
157 |
CODE, ":"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
158 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
159 |
evalExpectValue(<<CODE |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
160 |
function f() { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
161 |
var obj = { set ":"(a) {} }; |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
162 |
var desc = Object.getOwnPropertyDescriptor(obj, ":"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
163 |
return desc.set; |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
164 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
165 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
166 |
f() |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
167 |
CODE, "set \":\"(a) {}"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
168 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
169 |
// bug JDK-8047366 |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
170 |
// evalExpectValue("(1000000000000000128).toString()", "1000000000000000100"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
171 |
// evalExpectValue("(1000000000000000128).toFixed().toString()", "1000000000000000128"); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
172 |
|
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
173 |
try { |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
25235
diff
changeset
|
174 |
Function("-", { |
25235
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
175 |
toString: function() { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
176 |
throw "err" |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
177 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
178 |
})(); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
179 |
} catch (e) { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
180 |
if (e != "err") { |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
181 |
fail("Expected 'err' here, got " + e); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
182 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
183 |
} |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
184 |
evalExpectError("function f() { switch(x) {} } f()", ReferenceError); |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
185 |
Array.prototype.splice.call(Java.type("java.util.HashMap")) |
5e800a7fd352
8047369: Add regression tests for passing test cases of JDK-8024971
sundar
parents:
diff
changeset
|
186 |
Array.prototype.slice.call(Java.type("java.util.HashMap")) |