aboutsummaryrefslogtreecommitdiff
path: root/test/script/basic
diff options
context:
space:
mode:
authorEdward Nevill edward.nevill@linaro.org <Edward Nevill edward.nevill@linaro.org>2013-09-27 15:42:22 +0100
committerEdward Nevill edward.nevill@linaro.org <Edward Nevill edward.nevill@linaro.org>2013-09-27 15:42:22 +0100
commite93af65681ff4fb09c8b852c9a2a61e443be5f92 (patch)
tree53676a488a0ebe7e78c492066a4425d98aa382b6 /test/script/basic
parent7a1be74c8dd1f0d9d3ca59049cad188d2a06241d (diff)
parent127e24f2037a33b97b35584fb3cff868aebe51c0 (diff)
Merge up to jdk8-b90preview_rc1
Diffstat (limited to 'test/script/basic')
-rw-r--r--test/script/basic/JDK-8008238.js34
-rw-r--r--test/script/basic/JDK-8008814-3.js40
-rw-r--r--test/script/basic/JDK-8008814-3.js.EXPECTED1
-rw-r--r--test/script/basic/JDK-8008814-4.js40
-rw-r--r--test/script/basic/JDK-8008814-4.js.EXPECTED1
-rw-r--r--test/script/basic/JDK-8009230.js93
-rw-r--r--test/script/basic/JDK-8009230.js.EXPECTED45
-rw-r--r--test/script/basic/JDK-8010710.js (renamed from test/script/basic/JDK-8017010.js)0
-rw-r--r--test/script/basic/JDK-8010710.js.EXPECTED (renamed from test/script/basic/JDK-8017010.js.EXPECTED)0
-rw-r--r--test/script/basic/JDK-8010924.js67
-rw-r--r--test/script/basic/JDK-8011209.js76
-rw-r--r--test/script/basic/JDK-8011237.js39
-rw-r--r--test/script/basic/JDK-8011274.js48
-rw-r--r--test/script/basic/JDK-8011357.js68
-rw-r--r--test/script/basic/JDK-8011362.js34
-rw-r--r--test/script/basic/JDK-8011362.js.EXPECTED2
-rw-r--r--test/script/basic/JDK-8011365.js72
-rw-r--r--test/script/basic/JDK-8011382.js115
-rw-r--r--test/script/basic/JDK-8011394.js45
-rw-r--r--test/script/basic/JDK-8011421.js51
-rw-r--r--test/script/basic/JDK-8011543.js42
-rw-r--r--test/script/basic/JDK-8011552.js37
-rw-r--r--test/script/basic/JDK-8011555.js42
-rw-r--r--test/script/basic/JDK-8011555.js.EXPECTED1
-rw-r--r--test/script/basic/JDK-8011578.js42
-rw-r--r--test/script/basic/JDK-8011578.js.EXPECTED22
-rw-r--r--test/script/basic/JDK-8011714.js68
-rw-r--r--test/script/basic/JDK-8011714.js.EXPECTED27
-rw-r--r--test/script/basic/JDK-8011749.js38
-rw-r--r--test/script/basic/JDK-8011749.js.EXPECTED5
-rw-r--r--test/script/basic/JDK-8011756.js59
-rw-r--r--test/script/basic/JDK-8011756.js.EXPECTED22
-rw-r--r--test/script/basic/JDK-8011960.js53
-rw-r--r--test/script/basic/JDK-8011974.js39
-rw-r--r--test/script/basic/JDK-8011980.js34
-rw-r--r--test/script/basic/JDK-8011980.js.EXPECTED4
-rw-r--r--test/script/basic/JDK-8012240.js47
-rw-r--r--test/script/basic/JDK-8012334.js80
-rw-r--r--test/script/basic/JDK-8012334.js.EXPECTED200
-rw-r--r--test/script/basic/JDK-8012457.js46
-rw-r--r--test/script/basic/JDK-8012460.js59
-rw-r--r--test/script/basic/JDK-8012460.js.EXPECTED18
-rw-r--r--test/script/basic/JDK-8012462.js47
-rw-r--r--test/script/basic/JDK-8012931.js38
-rw-r--r--test/script/basic/JDK-8012931.js.EXPECTED1
-rw-r--r--test/script/basic/JDK-8013131.js66
-rw-r--r--test/script/basic/JDK-8013131.js.EXPECTED14
-rw-r--r--test/script/basic/JDK-8013167.js32
-rw-r--r--test/script/basic/JDK-8013167.js.EXPECTED1
-rw-r--r--test/script/basic/JDK-8013325.js44
-rw-r--r--test/script/basic/JDK-8013325.js.EXPECTED2
-rw-r--r--test/script/basic/JDK-8013337.js71
-rw-r--r--test/script/basic/JDK-8013337.js.EXPECTED17
-rw-r--r--test/script/basic/JDK-8013444.js49
-rw-r--r--test/script/basic/JDK-8013444.js.EXPECTED3
-rw-r--r--test/script/basic/javaclassoverrides.js86
-rw-r--r--test/script/basic/javaclassoverrides.js.EXPECTED9
-rw-r--r--test/script/basic/try2.js49
-rw-r--r--test/script/basic/try2.js.EXPECTED8
59 files changed, 2393 insertions, 0 deletions
diff --git a/test/script/basic/JDK-8008238.js b/test/script/basic/JDK-8008238.js
new file mode 100644
index 00000000..f58ec20a
--- /dev/null
+++ b/test/script/basic/JDK-8008238.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8008238: Labeled break in finally causes stack overflow in Node copy
+ *
+ * @test
+ * @run
+ */
+
+a: try {
+} finally {
+ break a;
+}
diff --git a/test/script/basic/JDK-8008814-3.js b/test/script/basic/JDK-8008814-3.js
new file mode 100644
index 00000000..87a9ebf4
--- /dev/null
+++ b/test/script/basic/JDK-8008814-3.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's not a compile time error to have a nested strict function declaration when the outer one is not strict
+ *
+ * @test
+ * @run
+ */
+
+function f() {
+ if(true) {
+ function g() {
+ "use strict";
+ print("g invoked!")
+ }
+ }
+ g()
+}
+f()
diff --git a/test/script/basic/JDK-8008814-3.js.EXPECTED b/test/script/basic/JDK-8008814-3.js.EXPECTED
new file mode 100644
index 00000000..dab29578
--- /dev/null
+++ b/test/script/basic/JDK-8008814-3.js.EXPECTED
@@ -0,0 +1 @@
+g invoked!
diff --git a/test/script/basic/JDK-8008814-4.js b/test/script/basic/JDK-8008814-4.js
new file mode 100644
index 00000000..baca0221
--- /dev/null
+++ b/test/script/basic/JDK-8008814-4.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's not a compile time error to have a nested function declaration when warnings are reported
+ *
+ * @option --function-statement-warning
+ * @test
+ * @run/ignore-std-error
+ */
+
+function f() {
+ if(true) {
+ function g() {
+ print("g invoked!")
+ }
+ }
+ g()
+}
+f()
diff --git a/test/script/basic/JDK-8008814-4.js.EXPECTED b/test/script/basic/JDK-8008814-4.js.EXPECTED
new file mode 100644
index 00000000..dab29578
--- /dev/null
+++ b/test/script/basic/JDK-8008814-4.js.EXPECTED
@@ -0,0 +1 @@
+g invoked!
diff --git a/test/script/basic/JDK-8009230.js b/test/script/basic/JDK-8009230.js
new file mode 100644
index 00000000..f161158a
--- /dev/null
+++ b/test/script/basic/JDK-8009230.js
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8009230: Nashorn rejects extended RegExp syntax accepted by all major JS engines
+ *
+ * @test
+ * @run
+ */
+
+
+// Invalid ControlEscape/IdentityEscape character treated as literal.
+print(/\z/.exec("z")); // Invalid escape, same as /z/
+// Incomplete/Invalid ControlEscape treated as "\\c"
+print(/\c/.exec("\\c")); // same as /\\c/
+print(/\c2/.exec("\\c2")); // same as /\\c2/
+print(/\C/.exec("C")); // same as /C/
+print(/\C2/.exec("C2")); // same as /C2/
+// Incomplete HexEscapeSequence escape treated as "x".
+print(/\x/.exec("x")); // incomplete x-escape
+print(/\x1/.exec("x1")); // incomplete x-escape
+print(/\x1z/.exec("x1z")); // incomplete x-escape
+// Incomplete UnicodeEscapeSequence escape treated as "u".
+print(/\u/.exec("u")); // incomplete u-escape
+print(/\uz/.exec("uz")); // incomplete u-escape
+print(/\u1/.exec("u1")); // incomplete u-escape
+print(/\u1z/.exec("u1z")); // incomplete u-escape
+print(/\u12/.exec("u12")); // incomplete u-escape
+print(/\u12z/.exec("u12z")); // incomplete u-escape
+print(/\u123/.exec("u123")); // incomplete u-escape
+print(/\u123z/.exec("u123z")); // incomplete u-escape
+// Bad quantifier range:
+print(/x{z/.exec("x{z")); // same as /x\{z/
+print(/x{1z/.exec("x{1z")); // same as /x\{1z/
+print(/x{1,z/.exec("x{1,z")); // same as /x\{1,z/
+print(/x{1,2z/.exec("x{1,2z")); // same as /x\{1,2z/
+print(/x{10000,20000z/.exec("x{10000,20000z")); // same as /x\{10000,20000z/
+// Notice: It needs arbitrary lookahead to determine the invalidity,
+// except Mozilla that limits the numbers.
+
+// Zero-initialized Octal escapes.
+/\012/; // same as /\x0a/
+
+// Nonexisting back-references smaller than 8 treated as octal escapes:
+print(/\5/.exec("\u0005")); // same as /\x05/
+print(/\7/.exec("\u0007")); // same as /\x07/
+print(/\8/.exec("\u0008")); // does not match
+
+// Invalid PatternCharacter accepted unescaped
+print(/]/.exec("]"));
+print(/{/.exec("{"));
+print(/}/.exec("}"));
+
+// Bad escapes also inside CharacterClass.
+print(/[\z]/.exec("z"));
+print(/[\c]/.exec("c"));
+print(/[\c2]/.exec("c"));
+print(/[\x]/.exec("x"));
+print(/[\x1]/.exec("x1"));
+print(/[\x1z]/.exec("x1z"));
+print(/[\u]/.exec("u"));
+print(/[\uz]/.exec("u"));
+print(/[\u1]/.exec("u"));
+print(/[\u1z]/.exec("u"));
+print(/[\u12]/.exec("u"));
+print(/[\u12z]/.exec("u"));
+print(/[\u123]/.exec("u"));
+print(/[\u123z]/.exec("u"));
+print(/[\012]/.exec("0"));
+print(/[\5]/.exec("5"));
+// And in addition:
+print(/[\B]/.exec("B"));
+print(/()()[\2]/.exec("")); // Valid backreference should be invalid.
diff --git a/test/script/basic/JDK-8009230.js.EXPECTED b/test/script/basic/JDK-8009230.js.EXPECTED
new file mode 100644
index 00000000..63f6e615
--- /dev/null
+++ b/test/script/basic/JDK-8009230.js.EXPECTED
@@ -0,0 +1,45 @@
+z
+\c
+\c2
+C
+C2
+x
+x1
+x1z
+u
+uz
+u1
+u1z
+u12
+u12z
+u123
+u123z
+x{z
+x{1z
+x{1,z
+x{1,2z
+x{10000,20000z
+
+
+null
+]
+{
+}
+z
+c
+null
+x
+x
+x
+u
+u
+u
+u
+u
+u
+u
+u
+null
+null
+B
+null
diff --git a/test/script/basic/JDK-8017010.js b/test/script/basic/JDK-8010710.js
index aa6e61a9..aa6e61a9 100644
--- a/test/script/basic/JDK-8017010.js
+++ b/test/script/basic/JDK-8010710.js
diff --git a/test/script/basic/JDK-8017010.js.EXPECTED b/test/script/basic/JDK-8010710.js.EXPECTED
index 296c81e5..296c81e5 100644
--- a/test/script/basic/JDK-8017010.js.EXPECTED
+++ b/test/script/basic/JDK-8010710.js.EXPECTED
diff --git a/test/script/basic/JDK-8010924.js b/test/script/basic/JDK-8010924.js
new file mode 100644
index 00000000..aaa7d129
--- /dev/null
+++ b/test/script/basic/JDK-8010924.js
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8010924: Dealing with undefined property gets you a fatal stack
+ *
+ * @test
+ * @run
+ * @option -scripting
+ */
+
+load("nashorn:mozilla_compat.js");
+
+if (this.non_existent_foo !== undefined) {
+ fail("this.non_existent_foo is defined!");
+}
+
+try {
+ non_existent_foo;
+ fail("should have thrown ReferenceError");
+} catch (e) {
+ if (! (e instanceof ReferenceError)) {
+ fail("ReferenceError expected, got " + e);
+ }
+}
+
+// try the same via script engine
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+var engine = new ScriptEngineManager().getEngineByName("nashorn");
+
+engine.eval("load('nashorn:mozilla_compat.js')");
+
+if (! engine.eval("this.non_existent_foo === undefined")) {
+ fail("this.non_existent_foo is not undefined");
+}
+
+engine.eval(<<EOF
+ try {
+ non_existent_foo;
+ throw new Error("should have thrown ReferenceError");
+ } catch (e) {
+ if (! (e instanceof ReferenceError)) {
+ throw new Error("ReferenceError expected, got " + e);
+ }
+ }
+EOF);
diff --git a/test/script/basic/JDK-8011209.js b/test/script/basic/JDK-8011209.js
new file mode 100644
index 00000000..9098dfaa
--- /dev/null
+++ b/test/script/basic/JDK-8011209.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011209: Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get.length is not 0
+ *
+ * @test
+ * @run
+ */
+
+var callerPropDesc = Object.getOwnPropertyDescriptor(function(){"use strict"},"caller");
+
+var getterLen = callerPropDesc.get.length;
+if (getterLen != 0) {
+ fail("caller's get.length != 0");
+}
+
+var setterLen = callerPropDesc.set.length;
+if (setterLen != 0) {
+ fail("caller's set.length != 1");
+}
+
+var argumentsPropDesc = Object.getOwnPropertyDescriptor(function(){"use strict"},"arguments");
+
+getterLen = argumentsPropDesc.get.length;
+if (getterLen != 0) {
+ fail("arguments's get.length != 0");
+}
+
+setterLen = argumentsPropDesc.set.length;
+if (setterLen != 0) {
+ fail("arguments's set.length != 1");
+}
+
+var strictArgs = (function() { 'use strict'; return arguments; })();
+callerPropDesc = Object.getOwnPropertyDescriptor(strictArgs,"caller");
+getterLen = callerPropDesc.get.length;
+if (getterLen != 0) {
+ fail("argument.caller's get.length != 0");
+}
+
+setterLen = callerPropDesc.set.length;
+if (setterLen != 0) {
+ fail("argument.caller's set.length != 1");
+}
+
+calleePropDesc = Object.getOwnPropertyDescriptor(strictArgs,"callee");
+getterLen = calleePropDesc.get.length;
+if (getterLen != 0) {
+ fail("argument.callee's get.length != 0");
+}
+
+setterLen = calleePropDesc.set.length;
+if (setterLen != 0) {
+ fail("argument.callee's set.length != 1");
+}
diff --git a/test/script/basic/JDK-8011237.js b/test/script/basic/JDK-8011237.js
new file mode 100644
index 00000000..e9e521a4
--- /dev/null
+++ b/test/script/basic/JDK-8011237.js
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011237: Object.isExtensible(Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get) should be false
+ *
+ * @test
+ * @run
+ */
+
+// ECMA Section 13.2.3 The [[ThrowTypeError]] Function Object
+// 11. Set the [[Extensible]] internal property of F to false
+
+var strictFunc = (function() { 'use strict' });
+var strictFuncCallerDesc = Object.getOwnPropertyDescriptor(strictFunc, "caller")
+var isExtensible = Object.isExtensible(strictFuncCallerDesc.get);
+if (isExtensible) {
+ fail("strict function caller's getter is extensible!");
+}
diff --git a/test/script/basic/JDK-8011274.js b/test/script/basic/JDK-8011274.js
new file mode 100644
index 00000000..b483c3e0
--- /dev/null
+++ b/test/script/basic/JDK-8011274.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011324: Object.getOwnPropertyDescriptor(function(){"use strict"},"caller").get.hasOwnProperty("prototype") should be false
+ *
+ * @test
+ * @run
+ */
+
+var strictFunc = (function() { 'use strict' });
+var desc = Object.getOwnPropertyDescriptor(strictFunc, "caller");
+if (desc.get.hasOwnProperty("prototype")) {
+ fail("strict function's caller getter has 'prototype' property");
+}
+
+// try few built-ins
+if (parseInt.hasOwnProperty("prototype")) {
+ fail("parseInt.hasOwnProperty('prototype') is true");
+}
+
+if (parseFloat.hasOwnProperty("prototype")) {
+ fail("parseFloat.hasOwnProperty('prototype') is true");
+}
+
+if (isFinite.hasOwnProperty("prototype")) {
+ fail("isFinite.hasOwnProperty('prototype') is true");
+}
diff --git a/test/script/basic/JDK-8011357.js b/test/script/basic/JDK-8011357.js
new file mode 100644
index 00000000..40efec5d
--- /dev/null
+++ b/test/script/basic/JDK-8011357.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011357: Array.prototype.slice and Array.prototype.splice should not call user defined valueOf of start, end arguments more than once
+ *
+ * @test
+ * @run
+ */
+
+var startValueOf = 0;
+var endValueOf = 0;
+
+[].slice(
+ {
+ valueOf: function() {
+ startValueOf++;
+ }
+ },
+ {
+ valueOf: function() {
+ endValueOf++;
+ }
+ }
+);
+
+if (startValueOf !== 1) {
+ fail("Array.prototype.slice should call valueOf on start arg once");
+}
+
+if (endValueOf !== 1) {
+ fail("Array.prototype.slice should call valueOf on end arg once");
+}
+
+startValueOf = 0;
+
+[].splice(
+ {
+ valueOf: function() {
+ startValueOf++;
+ }
+ }
+);
+
+if (startValueOf !== 1) {
+ fail("Array.prototype.splice should call valueOf on start arg once");
+}
+
diff --git a/test/script/basic/JDK-8011362.js b/test/script/basic/JDK-8011362.js
new file mode 100644
index 00000000..bda4851a
--- /dev/null
+++ b/test/script/basic/JDK-8011362.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011362: Overloaded method resolution foiled by nulls
+ *
+ * @test
+ * @run
+ */
+
+var subject = new (Java.type("jdk.nashorn.test.models.Jdk8011362TestSubject"))
+
+print(subject.overloaded("", null))
+print(subject.overloaded(0, null))
diff --git a/test/script/basic/JDK-8011362.js.EXPECTED b/test/script/basic/JDK-8011362.js.EXPECTED
new file mode 100644
index 00000000..e0eb4dc9
--- /dev/null
+++ b/test/script/basic/JDK-8011362.js.EXPECTED
@@ -0,0 +1,2 @@
+overloaded(String, String)
+overloaded(Double, Double)
diff --git a/test/script/basic/JDK-8011365.js b/test/script/basic/JDK-8011365.js
new file mode 100644
index 00000000..30802576
--- /dev/null
+++ b/test/script/basic/JDK-8011365.js
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011365: Array.prototype.join and Array.prototype.toString do not throw TypeError on null, undefined
+ *
+ * @test
+ * @run
+ */
+
+try {
+ Array.prototype.join.call(null, { toString:function() { throw 2 } });
+ fail("should have thrown TypeError");
+} catch (e) {
+ if (! (e instanceof TypeError)) {
+ fail("TypeError expected, got " + e);
+ }
+}
+
+// check all Array.prototype functions to be sure
+var names = Object.getOwnPropertyNames(Array.prototype);
+
+for (var n in names) {
+ var funcName = names[n];
+ // ignore constructor
+ if (funcName == "constructor") {
+ continue;
+ }
+
+ var prop = Array.prototype[funcName];
+ if (prop instanceof Function) {
+ // try 'null' this
+ try {
+ prop.call(null);
+ fail(funcName + " does not throw TypeError on 'null' this");
+ } catch (e) {
+ if (! (e instanceof TypeError)) {
+ fail("TypeError expected from " + funcName + ", got " + e);
+ }
+ }
+
+ // try 'undefined' this
+ try {
+ prop.call(undefined);
+ fail(funcName + " does not throw TypeError on 'undefined' this");
+ } catch (e) {
+ if (! (e instanceof TypeError)) {
+ fail("TypeError expected from " + funcName + ", got " + e);
+ }
+ }
+ }
+}
diff --git a/test/script/basic/JDK-8011382.js b/test/script/basic/JDK-8011382.js
new file mode 100644
index 00000000..13b3a771
--- /dev/null
+++ b/test/script/basic/JDK-8011382.js
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011382: Data prototype methods and constructor do not call user defined toISOString, valueOf methods per spec.
+ *
+ * @test
+ * @run
+ */
+
+var yearValueOf = 0;
+var monthValueOf = 0;
+var dayValueOf = 0;
+
+var d = new Date(
+ {
+ valueOf: function() { yearValueOf++; return NaN; }
+ },
+ {
+ valueOf: function() { monthValueOf++; return NaN; }
+ },
+ {
+ valueOf: function() { dayValueOf++; return NaN; }
+ }
+);
+
+if (yearValueOf !== 1) {
+ fail("Date constructor does not call valueOf on year argument once");
+}
+
+if (monthValueOf !== 1) {
+ fail("Date constructor does not call valueOf on month argument once");
+}
+
+if (dayValueOf !== 1) {
+ fail("Date constructor does not call valueOf on day argument once");
+}
+
+yearValueOf = 0;
+monthValueOf = 0;
+dayValueOf = 0;
+
+d = new Date();
+
+d.setFullYear(
+ {
+ valueOf: function() { yearValueOf++; return NaN; }
+ },
+ {
+ valueOf: function() { monthValueOf++; return NaN; }
+ },
+ {
+ valueOf: function() { dayValueOf++; return NaN; }
+ }
+);
+
+if (yearValueOf !== 1) {
+ fail("Date setFullYear does not call valueOf on year argument once");
+}
+
+if (monthValueOf !== 1) {
+ fail("Date setFullYear does not call valueOf on month argument once");
+}
+
+if (dayValueOf !== 1) {
+ fail("Date setFullYear does not call valueOf on day argument once");
+}
+
+// check toJSON calls toISOString override
+var toISOStringCalled = 0;
+d = new Date();
+d.toISOString = function() {
+ toISOStringCalled++;
+};
+
+d.toJSON();
+if (toISOStringCalled !== 1) {
+ fail("toISOString was not called by Date.prototype.toJSON once");
+}
+
+toISOStringCalled = 0;
+
+// toJSON is generic - try for non-Date object
+Date.prototype.toJSON.call({
+ toISOString: function() {
+ toISOStringCalled++;
+ },
+ valueOf: function() {
+ return 12;
+ }
+});
+
+if (toISOStringCalled !== 1) {
+ fail("toISOString was not called by Date.prototype.toJSON once");
+}
diff --git a/test/script/basic/JDK-8011394.js b/test/script/basic/JDK-8011394.js
new file mode 100644
index 00000000..070f5d3c
--- /dev/null
+++ b/test/script/basic/JDK-8011394.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011394: RegExp.prototype.test() does not call valueOf on lastIndex property as per the spec.
+ *
+ * @test
+ * @run
+ */
+
+var re = new RegExp();
+var lastIndexValueOfCalled = false;
+
+re.lastIndex = {
+ valueOf: function() {
+ lastIndexValueOfCalled = true;
+ return 0;
+ }
+};
+
+re.test("");
+
+if (! lastIndexValueOfCalled) {
+ fail("RegExp.prototype.test() does not call 'valueOf' on 'lastIndex'");
+}
diff --git a/test/script/basic/JDK-8011421.js b/test/script/basic/JDK-8011421.js
new file mode 100644
index 00000000..c1acef4b
--- /dev/null
+++ b/test/script/basic/JDK-8011421.js
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011421: When using Object.defineProperty on arrays, PropertyDescriptor's property accessors are invoked multiple times
+ *
+ * @test
+ * @run
+ */
+
+var configurableGetterCalled = 0;
+
+// create a property descriptor object with "configurable"
+// property with a user defined getter
+var propDesc = Object.defineProperty({},
+ "configurable",
+ {
+ get: function() {
+ configurableGetterCalled++;
+ return false
+ }
+ }
+);
+
+// make array length non-configurable
+Object.defineProperty([], "length", propDesc);
+
+// above should have called "configurable" getter only once
+if (configurableGetterCalled !== 1) {
+ fail("defineProperty on array should call propDesc getters only once");
+}
diff --git a/test/script/basic/JDK-8011543.js b/test/script/basic/JDK-8011543.js
new file mode 100644
index 00000000..49baef71
--- /dev/null
+++ b/test/script/basic/JDK-8011543.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011543: "".split(undefined,{valueOf:function(){throw 2}}) does not throw exception
+ *
+ * @test
+ * @run
+ */
+
+try {
+ "".split(undefined,{
+ valueOf: function() {
+ throw 42;
+ }
+ });
+ fail("should have thrown 42");
+} catch (e) {
+ if (e != 42) {
+ fail("expected 42 to be thrown");
+ }
+}
diff --git a/test/script/basic/JDK-8011552.js b/test/script/basic/JDK-8011552.js
new file mode 100644
index 00000000..f0735a00
--- /dev/null
+++ b/test/script/basic/JDK-8011552.js
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011552: Arrays with missing elements are not properly sorted
+ *
+ * @test
+ * @run
+ */
+
+if ([,void 0].sort().hasOwnProperty("1")) {
+ fail("missing element found in sorted array");
+}
+
+if ([1,,2,,-1].sort().toString() != "-1,1,2,,") {
+ faiil("missing elements are not at the end of sorted array");
+}
diff --git a/test/script/basic/JDK-8011555.js b/test/script/basic/JDK-8011555.js
new file mode 100644
index 00000000..c65ad612
--- /dev/null
+++ b/test/script/basic/JDK-8011555.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011555: Invalid class name in with block with JavaImporter causes MH type mismatch
+ *
+ * @test
+ * @run
+ */
+
+with(new JavaImporter()) {
+ try {
+ new X()
+ print("Expected to fail!")
+ } catch(e) {
+ // We expect to get a TypeError for trying to use __noSuchMethod__ as
+ // a constructor. Before we fixed this bug, we were getting a runtime
+ // exception with MH type mismatch on a MH.foldArguments within the
+ // WithObject code instead.
+ print(e)
+ }
+}
diff --git a/test/script/basic/JDK-8011555.js.EXPECTED b/test/script/basic/JDK-8011555.js.EXPECTED
new file mode 100644
index 00000000..c296217a
--- /dev/null
+++ b/test/script/basic/JDK-8011555.js.EXPECTED
@@ -0,0 +1 @@
+TypeError: function __noSuchMethod__() { [native code] } is not a constructor function
diff --git a/test/script/basic/JDK-8011578.js b/test/script/basic/JDK-8011578.js
new file mode 100644
index 00000000..9a2f7438
--- /dev/null
+++ b/test/script/basic/JDK-8011578.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011578 : -Dnashorn.unstable.relink.threshold=1 causes tests to fail.
+ *
+ * @test
+ * @option -Dnashorn.unstable.relink.threshold=1
+ * @run
+ */
+
+load(__DIR__ + "NASHORN-296.js");
+load(__DIR__ + "NASHORN-691.js");
+load(__DIR__ + "calllink.js");
+load(__DIR__ + "nosuchproperty.js");
+
+__noSuchProperty__ = function(x) {
+ print(x);
+ return x;
+}
+
+print(this["find"]);
diff --git a/test/script/basic/JDK-8011578.js.EXPECTED b/test/script/basic/JDK-8011578.js.EXPECTED
new file mode 100644
index 00000000..aa7184a7
--- /dev/null
+++ b/test/script/basic/JDK-8011578.js.EXPECTED
@@ -0,0 +1,22 @@
+o.foo = 33
+o.foo = 44
+o.foo = 3
+o.foo = hello
+obj1.func called
+obj2.func called
+no such method: func
+obj4's prototype func called
+MyConstructor.prototype.func
+MyConstructor.prototype.func
+obj1.func called
+obj2.func called
+new obj3.func called
+new obj4.func called
+all new MyConstructor.prototype.func
+all new MyConstructor.prototype.func
+obj.__noSuchProperty__ for foo
+new obj.__noSuchProperty__ for foo
+proto.__noSuchProperty__ for foo
+new proto.__noSuchProperty__ for foo
+find
+find
diff --git a/test/script/basic/JDK-8011714.js b/test/script/basic/JDK-8011714.js
new file mode 100644
index 00000000..dac00743
--- /dev/null
+++ b/test/script/basic/JDK-8011714.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011714: Regexp decimal escape handling still not correct
+ *
+ * @test
+ * @run
+ */
+
+// \0 should be interpreted as <NUL> character here
+print(/\08/.test("\x008"));
+print(/[\08]/.test("8"));
+print(/[\08]/.test("\x00"));
+
+// Can't be converted to octal thus encoded as literal char sequence
+print(/\8/.exec("\\8"));
+print(/[\8]/.exec("\\"));
+print(/[\8]/.exec("8"));
+
+// 0471 is too high for an octal escape so it is \047 outside a character class
+// and \\471 inside a character class
+print(/\471/.exec("\x271"));
+print(/[\471]/.exec("1"));
+print(/[\471]/.exec("\x27"));
+
+// 0366 is a valid octal escape (246)
+print(/\366/.test("\xf6"));
+print(/[\366]/.test("\xf6"));
+print(/[\366]/.test("\xf6"));
+
+// more tests for conversion of invalid backreferences to octal escapes or literals
+print(/(a)(b)(c)(d)\4/.exec("abcdd"));
+print(/(a)(b)(c)(d)\4x/.exec("abcddx"));
+print(/(a)(b)(c)(d)\47/.exec("abcdd7"));
+print(/(a)(b)(c)(d)\47/.exec("abcd\x27"));
+print(/(a)(b)(c)(d)\47xyz/.exec("abcd\x27xyz"));
+print(/(a)(b)(c)(d)[\47]/.exec("abcd\x27"));
+print(/(a)(b)(c)(d)[\47]xyz/.exec("abcd\x27xyz"));
+print(/(a)(b)(c)(d)\48/.exec("abcd\x048"));
+print(/(a)(b)(c)(d)\48xyz/.exec("abcd\x048xyz"));
+print(/(a)(b)(c)(d)[\48]/.exec("abcd\x04"));
+print(/(a)(b)(c)(d)[\48]xyz/.exec("abcd\x04xyz"));
+print(/(a)(b)(c)(d)\84/.exec("abcd84"));
+print(/(a)(b)(c)(d)\84xyz/.exec("abcd84xyz"));
+print(/(a)(b)(c)(d)[\84]/.exec("abcd8"));
+print(/(a)(b)(c)(d)[\84]xyz/.exec("abcd8xyz"));
+
diff --git a/test/script/basic/JDK-8011714.js.EXPECTED b/test/script/basic/JDK-8011714.js.EXPECTED
new file mode 100644
index 00000000..c5a8b345
--- /dev/null
+++ b/test/script/basic/JDK-8011714.js.EXPECTED
@@ -0,0 +1,27 @@
+true
+true
+true
+8
+null
+8
+'1
+1
+'
+true
+true
+true
+abcdd,a,b,c,d
+abcddx,a,b,c,d
+null
+abcd',a,b,c,d
+abcd'xyz,a,b,c,d
+abcd',a,b,c,d
+abcd'xyz,a,b,c,d
+abcd8,a,b,c,d
+abcd8xyz,a,b,c,d
+abcd,a,b,c,d
+abcdxyz,a,b,c,d
+abcd84,a,b,c,d
+abcd84xyz,a,b,c,d
+abcd8,a,b,c,d
+abcd8xyz,a,b,c,d
diff --git a/test/script/basic/JDK-8011749.js b/test/script/basic/JDK-8011749.js
new file mode 100644
index 00000000..41d9ac64
--- /dev/null
+++ b/test/script/basic/JDK-8011749.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011749: Bugs with empty character class handling
+ *
+ * @test
+ * @run
+ */
+
+// empty class in alternative
+print(/[]|[^]/.exec("a"));
+print(/[]|[]/.test("a"));
+print(/[]|[]|[a]/.exec("a"));
+
+// empty class in negative lookahead
+print(/(?![])/.test(""));
+print(/(?![])./.exec("a"));
diff --git a/test/script/basic/JDK-8011749.js.EXPECTED b/test/script/basic/JDK-8011749.js.EXPECTED
new file mode 100644
index 00000000..82d8c103
--- /dev/null
+++ b/test/script/basic/JDK-8011749.js.EXPECTED
@@ -0,0 +1,5 @@
+a
+false
+a
+true
+a
diff --git a/test/script/basic/JDK-8011756.js b/test/script/basic/JDK-8011756.js
new file mode 100644
index 00000000..c0e8d834
--- /dev/null
+++ b/test/script/basic/JDK-8011756.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011756: Wrong characters supported in RegExp \c escape
+ *
+ * @test
+ * @run
+ */
+
+
+// Invalid control letters should be escaped:
+print(/\cı/.test("\x09"));
+print(/\cı/.test("\\cı"));
+
+print(/\cſ/.test("\x13"));
+print(/\cſ/.test("\\cſ"));
+
+print(/[\cſ]/.test("\x13"));
+print(/[\cſ]/.test("\\"));
+print(/[\cſ]/.test("c"));
+print(/[\cſ]/.test("ſ"));
+
+print(/[\c#]/.test("\\"));
+print(/[\c#]/.test("c"));
+print(/[\c#]/.test("#"));
+
+// The characters that are supported by other engines are '0'-'9', '_':
+print(/[\c0]/.test("\x10"));
+print(/[\c1]/.test("\x11"));
+print(/[\c2]/.test("\x12"));
+print(/[\c3]/.test("\x13"));
+print(/[\c4]/.test("\x14"));
+print(/[\c5]/.test("\x15"));
+print(/[\c6]/.test("\x16"));
+print(/[\c7]/.test("\x17"));
+print(/[\c8]/.test("\x18"));
+print(/[\c9]/.test("\x19"));
+print(/[\c_]/.test("\x1F"));
diff --git a/test/script/basic/JDK-8011756.js.EXPECTED b/test/script/basic/JDK-8011756.js.EXPECTED
new file mode 100644
index 00000000..63722a57
--- /dev/null
+++ b/test/script/basic/JDK-8011756.js.EXPECTED
@@ -0,0 +1,22 @@
+false
+true
+false
+true
+false
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
diff --git a/test/script/basic/JDK-8011960.js b/test/script/basic/JDK-8011960.js
new file mode 100644
index 00000000..f691d2c8
--- /dev/null
+++ b/test/script/basic/JDK-8011960.js
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011960: [2,1].sort(null) should throw TypeError
+ *
+ * @test
+ * @run
+ */
+
+function check(func) {
+ try {
+ [2,1].sort(func);
+ fail("should have thrown TypeError for :" + func);
+ } catch (e) {
+ if (! (e instanceof TypeError)) {
+ fail("TypeError not thrown for sort comparefn: " + func);
+ }
+ }
+}
+
+// should not result in TypeError for undefined
+[1, 2].sort(undefined);
+
+// TypeError for null
+check(null);
+
+// should result in TypeError other non-callable params
+check(32);
+check("foo");
+check(false);
+check({});
+check([]);
diff --git a/test/script/basic/JDK-8011974.js b/test/script/basic/JDK-8011974.js
new file mode 100644
index 00000000..f3f9b4ae
--- /dev/null
+++ b/test/script/basic/JDK-8011974.js
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011974: Comparator function returning negative and positive Infinity does not work as expected with Array.prototype.sort
+ *
+ * @test
+ * @run
+ */
+
+function compare(x, y) {
+ return x < y? -Infinity : (x > y? Infinity: 0)
+}
+
+var sorted = [5, 4, 3, 2, 1].sort(compare);
+
+if (sorted + '' != "1,2,3,4,5") {
+ fail("Array.prototype.sort does not work when compare returns +/-Infinity");
+}
diff --git a/test/script/basic/JDK-8011980.js b/test/script/basic/JDK-8011980.js
new file mode 100644
index 00000000..a83f2864
--- /dev/null
+++ b/test/script/basic/JDK-8011980.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011980: Allow NUL character in character class
+ *
+ * @test
+ * @run
+ */
+
+print(RegExp("\0").test("\0"));
+print(RegExp("[\0]").test("\0"));
+print(RegExp("[\x00]").test("\0"));
+print(RegExp("[\u0000]").test("\0"));
diff --git a/test/script/basic/JDK-8011980.js.EXPECTED b/test/script/basic/JDK-8011980.js.EXPECTED
new file mode 100644
index 00000000..1140ff52
--- /dev/null
+++ b/test/script/basic/JDK-8011980.js.EXPECTED
@@ -0,0 +1,4 @@
+true
+true
+true
+true
diff --git a/test/script/basic/JDK-8012240.js b/test/script/basic/JDK-8012240.js
new file mode 100644
index 00000000..2ac6eaf7
--- /dev/null
+++ b/test/script/basic/JDK-8012240.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012240: Array.prototype.map.call({length: -1, get 0(){throw 0}}, function(){}).length does not throw error
+ *
+ * @test
+ * @run
+ */
+
+var in_getter_for_0 = false;
+
+try {
+ Array.prototype.map.call(
+ {
+ length: -1,
+ get 0() {
+ in_getter_for_0 = true;
+ throw 0;
+ }
+ },
+ function(){}).length;
+} catch (e) {
+ if (e !== 0 || !in_getter_for_0) {
+ fail("should have thrown error from getter for '0'th element");
+ }
+}
diff --git a/test/script/basic/JDK-8012334.js b/test/script/basic/JDK-8012334.js
new file mode 100644
index 00000000..4a1c7a3c
--- /dev/null
+++ b/test/script/basic/JDK-8012334.js
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012334: ToUint32, ToInt32, and ToUint16 don't conform to spec
+ *
+ * @test
+ * @run
+ */
+
+
+function test(val) {
+ print(val | 0);
+ print(val >> 0);
+ print(val >>> 0);
+ print(1 >>> val);
+ print(parseInt("10", val));
+}
+
+test(0);
+test(-0);
+test('Infinity');
+test('+Infinity');
+test('-Infinity');
+test(Number.POSITIVE_INFINITY);
+test(Number.NEGATIVE_INFINITY);
+test(Number.NaN);
+test(Number.MIN_VALUE);
+test(-Number.MIN_VALUE);
+test(1);
+test(-1);
+test(0.1);
+test(-0.1);
+test(1.1);
+test(-1.1);
+test(9223372036854775807);
+test(-9223372036854775808);
+test('9223372036854775807');
+test('-9223372036854775808');
+test(2147483647);
+test(2147483648);
+test(2147483649);
+test(-2147483647);
+test(-2147483648);
+test(-2147483649);
+test(4294967295);
+test(4294967296);
+test(4294967297);
+test(-4294967295);
+test(-4294967296);
+test(-4294967297);
+test(1e23);
+test(-1e23);
+test(1e24);
+test(-1e24);
+test(1e25);
+test(-1e25);
+test(1e26);
+test(-1e26);
+
diff --git a/test/script/basic/JDK-8012334.js.EXPECTED b/test/script/basic/JDK-8012334.js.EXPECTED
new file mode 100644
index 00000000..d9b16f41
--- /dev/null
+++ b/test/script/basic/JDK-8012334.js.EXPECTED
@@ -0,0 +1,200 @@
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+2147483647
+2147483647
+2147483647
+0
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+-2147483647
+-2147483647
+2147483649
+0
+NaN
+-2147483647
+-2147483647
+2147483649
+0
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+2147483647
+2147483647
+2147483647
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+1
+1
+1
+0
+NaN
+0
+0
+0
+1
+10
+-1
+-1
+4294967295
+0
+NaN
+-167772160
+-167772160
+4127195136
+1
+NaN
+167772160
+167772160
+167772160
+1
+NaN
+-1610612736
+-1610612736
+2684354560
+1
+NaN
+1610612736
+1610612736
+1610612736
+1
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
diff --git a/test/script/basic/JDK-8012457.js b/test/script/basic/JDK-8012457.js
new file mode 100644
index 00000000..2f71a9a9
--- /dev/null
+++ b/test/script/basic/JDK-8012457.js
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012457: Function.prototype.apply should accept any array-like argument for function arguments
+ *
+ * @test
+ * @run
+ */
+
+// no exception for these
+Function().apply(null, {length: null})
+Function().apply(null, {length: 0.1})
+
+// getter should be called
+var getter_0_called = false;
+
+Function().apply(null,
+ Object.defineProperty([],"0",
+ { get: function(){ getter_0_called = true; return 0 }
+ })
+);
+
+if (! getter_0_called) {
+ fail("getter for '0' of arguments array not called");
+}
diff --git a/test/script/basic/JDK-8012460.js b/test/script/basic/JDK-8012460.js
new file mode 100644
index 00000000..0b41298d
--- /dev/null
+++ b/test/script/basic/JDK-8012460.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012460: RegExp regression
+ *
+ * @test
+ * @run
+ */
+
+
+var semver = "\\s*[v=]*\\s*([0-9]+)" // major
+ + "\\.([0-9]+)" // minor
+ + "\\.([0-9]+)" // patch
+ + "(-[0-9]+-?)?" // build
+ + "([a-zA-Z-+][a-zA-Z0-9-\.:]*)?" // tag
+ , exprComparator = "^((<|>)?=?)\s*("+semver+")$|^$";
+var validComparator = new RegExp("^"+exprComparator+"$");
+
+
+print(exprComparator);
+print(">=0.6.0-".match(validComparator));
+print("=0.6.0-".match(validComparator));
+print("0.6.0-".match(validComparator));
+print("<=0.6.0-".match(validComparator));
+print(">=0.6.0-a:b-c.d".match(validComparator));
+print("=0.6.0-a:b-c.d".match(validComparator));
+print("0.6.0+a:b-c.d".match(validComparator));
+print("<=0.6.0+a:b-c.d".match(validComparator));
+
+print(/[a-zA-Z-+]/.exec("a"));
+print(/[a-zA-Z-+]/.exec("b"));
+print(/[a-zA-Z-+]/.exec("y"));
+print(/[a-zA-Z-+]/.exec("z"));
+print(/[a-zA-Z-+]/.exec("B"));
+print(/[a-zA-Z-+]/.exec("Y"));
+print(/[a-zA-Z-+]/.exec("Z"));
+print(/[a-zA-Z-+]/.exec("-"));
+print(/[a-zA-Z-+]/.exec("+"));
diff --git a/test/script/basic/JDK-8012460.js.EXPECTED b/test/script/basic/JDK-8012460.js.EXPECTED
new file mode 100644
index 00000000..917cac54
--- /dev/null
+++ b/test/script/basic/JDK-8012460.js.EXPECTED
@@ -0,0 +1,18 @@
+^((<|>)?=?)s*(\s*[v=]*\s*([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9]+-?)?([a-zA-Z-+][a-zA-Z0-9-.:]*)?)$|^$
+>=0.6.0-,>=,>,0.6.0-,0,6,0,,-
+=0.6.0-,=,,0.6.0-,0,6,0,,-
+0.6.0-,,,0.6.0-,0,6,0,,-
+<=0.6.0-,<=,<,0.6.0-,0,6,0,,-
+>=0.6.0-a:b-c.d,>=,>,0.6.0-a:b-c.d,0,6,0,,-a:b-c.d
+=0.6.0-a:b-c.d,=,,0.6.0-a:b-c.d,0,6,0,,-a:b-c.d
+0.6.0+a:b-c.d,,,0.6.0+a:b-c.d,0,6,0,,+a:b-c.d
+<=0.6.0+a:b-c.d,<=,<,0.6.0+a:b-c.d,0,6,0,,+a:b-c.d
+a
+b
+y
+z
+B
+Y
+Z
+-
++
diff --git a/test/script/basic/JDK-8012462.js b/test/script/basic/JDK-8012462.js
new file mode 100644
index 00000000..4e015a99
--- /dev/null
+++ b/test/script/basic/JDK-8012462.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012462: Date.prototype.toJSON does not handle non-Date 'this' as per the spec.
+ *
+ * @test
+ * @run
+ */
+
+var toJSON = Date.prototype.toJSON;
+
+function checkJSON(value, expected) {
+ var res = toJSON.call({
+ valueOf: function() { return value; },
+ toISOString: function() { return value; }
+ });
+
+ if (res !== expected) {
+ fail("Date.prototype.toJSON does not work for non-Date 'this'");
+ }
+}
+
+checkJSON(NaN, null);
+checkJSON(-Infinity, null);
+checkJSON(Infinity, null);
+checkJSON("foo", "foo");
diff --git a/test/script/basic/JDK-8012931.js b/test/script/basic/JDK-8012931.js
new file mode 100644
index 00000000..c3119b93
--- /dev/null
+++ b/test/script/basic/JDK-8012931.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012931: NativeDate.safeToString() throws RangeError for invalid date
+ *
+ * @test
+ * @run
+ */
+
+var d = new Date(NaN);
+d.toString = Number.prototype.toString;
+
+try {
+ d.toString();
+} catch(e) {
+ print(e);
+}
diff --git a/test/script/basic/JDK-8012931.js.EXPECTED b/test/script/basic/JDK-8012931.js.EXPECTED
new file mode 100644
index 00000000..0e84e7da
--- /dev/null
+++ b/test/script/basic/JDK-8012931.js.EXPECTED
@@ -0,0 +1 @@
+TypeError: [Date Invalid Date] is not a Number
diff --git a/test/script/basic/JDK-8013131.js b/test/script/basic/JDK-8013131.js
new file mode 100644
index 00000000..dfff8ac6
--- /dev/null
+++ b/test/script/basic/JDK-8013131.js
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013131: Various compatibility issues in String.prototype.split()
+ *
+ * @test
+ * @run
+ */
+
+
+// Make sure limit is honored with undefined/empty separator
+print(JSON.stringify("aa".split(undefined, 0)));
+print(JSON.stringify("abc".split("", 1)));
+
+// Make sure limit is honored with capture groups
+print(JSON.stringify("aa".split(/(a)/, 1)));
+print(JSON.stringify("aa".split(/(a)/, 2)));
+print(JSON.stringify("aa".split(/((a))/, 1)));
+print(JSON.stringify("aa".split(/((a))/, 2)));
+
+// Empty capture group at end of string should be ignored
+print(JSON.stringify("aaa".split(/((?:))/)));
+
+// Tests below are to make sure that split does not read or write lastIndex property
+var r = /a/;
+r.lastIndex = {
+ valueOf: function(){throw 2}
+};
+print(JSON.stringify("aa".split(r)));
+
+r = /a/g;
+r.lastIndex = 100;
+print(JSON.stringify("aa".split(r)));
+print(r.lastIndex);
+
+r = /((?:))/g;
+r.lastIndex = 100;
+print(JSON.stringify("aaa".split(r)));
+print(r.lastIndex);
+
+// Make sure lastIndex is not updated on non-global regexp
+r = /a/;
+r.lastIndex = 100;
+print(JSON.stringify(r.exec("aaa")));
+print(r.lastIndex);
diff --git a/test/script/basic/JDK-8013131.js.EXPECTED b/test/script/basic/JDK-8013131.js.EXPECTED
new file mode 100644
index 00000000..9e0fa963
--- /dev/null
+++ b/test/script/basic/JDK-8013131.js.EXPECTED
@@ -0,0 +1,14 @@
+[]
+["a"]
+[""]
+["","a"]
+[""]
+["","a"]
+["a","","a","","a"]
+["","",""]
+["","",""]
+100
+["a","","a","","a"]
+100
+["a"]
+100
diff --git a/test/script/basic/JDK-8013167.js b/test/script/basic/JDK-8013167.js
new file mode 100644
index 00000000..ec3c71a1
--- /dev/null
+++ b/test/script/basic/JDK-8013167.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013167: Vararg constructor was not found
+ *
+ * @test
+ * @run
+ */
+
+var x = new Packages.jdk.nashorn.test.models.VarArgConstructor(1, false, "a", "b", "c")
+print(x.indicator) \ No newline at end of file
diff --git a/test/script/basic/JDK-8013167.js.EXPECTED b/test/script/basic/JDK-8013167.js.EXPECTED
new file mode 100644
index 00000000..e632d3be
--- /dev/null
+++ b/test/script/basic/JDK-8013167.js.EXPECTED
@@ -0,0 +1 @@
+vararg
diff --git a/test/script/basic/JDK-8013325.js b/test/script/basic/JDK-8013325.js
new file mode 100644
index 00000000..e1faa7b7
--- /dev/null
+++ b/test/script/basic/JDK-8013325.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013325: function named 'arguments' should still access arguments object within itself.
+ * Its parent should however see the function and not an arguments object.
+ *
+ * @test
+ * @run
+ */
+
+function x() {
+ // x doesn't see an arguments object as it has a nested function with that name
+ // so it'll invoke the function.
+ arguments("a", "b", "c");
+
+ function arguments(x, y, z) {
+ // The function 'arguments' OTOH can't see itself; if it uses the
+ // identifier 'arguments', it'll see its own arguments object.
+ print(arguments)
+ print(x + " " + y + " " + z)
+ }
+}
+x()
diff --git a/test/script/basic/JDK-8013325.js.EXPECTED b/test/script/basic/JDK-8013325.js.EXPECTED
new file mode 100644
index 00000000..e2dc7e54
--- /dev/null
+++ b/test/script/basic/JDK-8013325.js.EXPECTED
@@ -0,0 +1,2 @@
+[object Arguments]
+a b c
diff --git a/test/script/basic/JDK-8013337.js b/test/script/basic/JDK-8013337.js
new file mode 100644
index 00000000..b95da8bd
--- /dev/null
+++ b/test/script/basic/JDK-8013337.js
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013337: Issues with Date.prototype's get, set functions
+ *
+ * @test
+ * @option -timezone=Asia/Calcutta
+ * @run
+ */
+
+function check(str) {
+ print(str + " = " + eval(str));
+}
+
+check('new Date(NaN).setFullYear(NaN)');
+check('new Date(0).setYear(70)');
+check('new Date(0).setYear(NaN)');
+check('new Date(NaN).setYear(70)');
+check('new Date(NaN).getTimezoneOffset()');
+
+function checkGetterCalled(func) {
+ var getterCalled = false;
+
+ new Date(NaN)[func]( { valueOf: function() { getterCalled = true } } );
+
+ if (getterCalled) {
+ print("Date.prototype." + func + " calls valueOf on arg");
+ }
+}
+
+checkGetterCalled("setMilliseconds");
+checkGetterCalled("setUTCMilliseconds");
+checkGetterCalled("setSeconds");
+checkGetterCalled("setUTCSeconds");
+checkGetterCalled("setMinutes");
+checkGetterCalled("setUTCMinutes");
+checkGetterCalled("setHours");
+checkGetterCalled("setUTCHours");
+checkGetterCalled("setDate");
+checkGetterCalled("setUTCDate");
+checkGetterCalled("setMonth");
+checkGetterCalled("setUTCMonth");
+
+try {
+ Date.prototype.setTime.call({}, { valueOf: function() { throw "err" } })
+} catch (e) {
+ if (! (e instanceof TypeError)) {
+ fail("TypeError expected, got " + e);
+ }
+}
diff --git a/test/script/basic/JDK-8013337.js.EXPECTED b/test/script/basic/JDK-8013337.js.EXPECTED
new file mode 100644
index 00000000..fbd2d655
--- /dev/null
+++ b/test/script/basic/JDK-8013337.js.EXPECTED
@@ -0,0 +1,17 @@
+new Date(NaN).setFullYear(NaN) = NaN
+new Date(0).setYear(70) = 0
+new Date(0).setYear(NaN) = NaN
+new Date(NaN).setYear(70) = -19800000
+new Date(NaN).getTimezoneOffset() = NaN
+Date.prototype.setMilliseconds calls valueOf on arg
+Date.prototype.setUTCMilliseconds calls valueOf on arg
+Date.prototype.setSeconds calls valueOf on arg
+Date.prototype.setUTCSeconds calls valueOf on arg
+Date.prototype.setMinutes calls valueOf on arg
+Date.prototype.setUTCMinutes calls valueOf on arg
+Date.prototype.setHours calls valueOf on arg
+Date.prototype.setUTCHours calls valueOf on arg
+Date.prototype.setDate calls valueOf on arg
+Date.prototype.setUTCDate calls valueOf on arg
+Date.prototype.setMonth calls valueOf on arg
+Date.prototype.setUTCMonth calls valueOf on arg
diff --git a/test/script/basic/JDK-8013444.js b/test/script/basic/JDK-8013444.js
new file mode 100644
index 00000000..166575cd
--- /dev/null
+++ b/test/script/basic/JDK-8013444.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013444: JSON.parse does not invoke "reviver" callback as per spec.
+ *
+ * @test
+ * @run
+ */
+
+
+var type = typeof JSON.parse('{}',function(){})
+print("type is " + type);
+
+var obj = JSON.parse('{"name": "nashorn"}',
+ function(k, v) {
+ if (k === "") return v;
+ return v.toUpperCase();
+ });
+print(JSON.stringify(obj))
+
+var array =
+ JSON.parse("[1, 3, 5, 7, 9, 11]",
+ function(k, v) {
+ if (k === "") return v;
+ return v*2;
+ }
+ );
+print(array)
diff --git a/test/script/basic/JDK-8013444.js.EXPECTED b/test/script/basic/JDK-8013444.js.EXPECTED
new file mode 100644
index 00000000..2214e49b
--- /dev/null
+++ b/test/script/basic/JDK-8013444.js.EXPECTED
@@ -0,0 +1,3 @@
+type is undefined
+{"name":"NASHORN"}
+2,6,10,14,18,22
diff --git a/test/script/basic/javaclassoverrides.js b/test/script/basic/javaclassoverrides.js
new file mode 100644
index 00000000..e7ad61d8
--- /dev/null
+++ b/test/script/basic/javaclassoverrides.js
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Check behavior of class-level overrides.
+ *
+ * @test
+ * @run
+ */
+
+
+// Make two classes with class overrides
+
+var R1 = Java.extend(java.lang.Runnable, {
+ run: function() {
+ print("R1.run() invoked")
+ }
+})
+
+var R2 = Java.extend(java.lang.Runnable, {
+ run: function() {
+ print("R2.run() invoked")
+ }
+})
+
+var r1 = new R1
+var r2 = new R2
+// Create one with an instance-override too
+var r3 = new R2(function() { print("r3.run() invoked") })
+
+// Run 'em - we're passing them through a Thread to make sure they indeed
+// are full-blown Runnables
+function runInThread(r) {
+ var t = new java.lang.Thread(r)
+ t.start()
+ t.join()
+}
+runInThread(r1)
+runInThread(r2)
+runInThread(r3)
+
+// Two class-override classes differ
+print("r1.class != r2.class: " + (r1.class != r2.class))
+// However, adding instance-overrides doesn't change the class
+print("r2.class == r3.class: " + (r2.class == r3.class))
+
+function checkAbstract(r) {
+ try {
+ r.run()
+ print("Expected to fail!")
+ } catch(e) {
+ print("Got exception: " + e)
+ }
+}
+
+// Check we're hitting UnsupportedOperationException if neither class
+// overrides nor instance overrides are present
+var RAbstract = Java.extend(java.lang.Runnable, {})
+checkAbstract(new RAbstract()) // class override (empty)
+checkAbstract(new RAbstract() {}) // class+instance override (empty)
+
+// Check we delegate to superclass if neither class
+// overrides nor instance overrides are present
+var ExtendsList = Java.extend(java.util.ArrayList, {})
+print("(new ExtendsList).size() = " + (new ExtendsList).size())
+print("(new ExtendsList(){}).size() = " + (new ExtendsList(){}).size()) \ No newline at end of file
diff --git a/test/script/basic/javaclassoverrides.js.EXPECTED b/test/script/basic/javaclassoverrides.js.EXPECTED
new file mode 100644
index 00000000..6c534302
--- /dev/null
+++ b/test/script/basic/javaclassoverrides.js.EXPECTED
@@ -0,0 +1,9 @@
+R1.run() invoked
+R2.run() invoked
+r3.run() invoked
+r1.class != r2.class: true
+r2.class == r3.class: true
+Got exception: java.lang.UnsupportedOperationException
+Got exception: java.lang.UnsupportedOperationException
+(new ExtendsList).size() = 0
+(new ExtendsList(){}).size() = 0
diff --git a/test/script/basic/try2.js b/test/script/basic/try2.js
new file mode 100644
index 00000000..8a59c89b
--- /dev/null
+++ b/test/script/basic/try2.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Try throw test - nest finally
+ *
+ * @test
+ * @run
+ */
+
+function f() {
+ print("a");
+ try {
+ print("b");
+ } finally {
+ print("c");
+ try {
+ print("d");
+ } finally {
+ print("e");
+ }
+ print("f");
+ }
+ print("g");
+}
+
+f();
+
+print("done");
diff --git a/test/script/basic/try2.js.EXPECTED b/test/script/basic/try2.js.EXPECTED
new file mode 100644
index 00000000..603b8cd1
--- /dev/null
+++ b/test/script/basic/try2.js.EXPECTED
@@ -0,0 +1,8 @@
+a
+b
+c
+d
+e
+f
+g
+done