aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsundar <none@none>2013-11-01 19:54:48 +0530
committersundar <none@none>2013-11-01 19:54:48 +0530
commitf18981c761509d7dd82faf8bc0f9cd1ebdf96c25 (patch)
treeff2e6a3e944d0ef1878e9d16bd4f0b57fdb102a7 /test
parent5e8224727d0ef50157dee66eecb138a2aea3312e (diff)
downloadnashorn-f18981c761509d7dd82faf8bc0f9cd1ebdf96c25.tar.gz
8027700: function redeclaration checks missing for declaration binding instantiation
Reviewed-by: jlaskey, lagergren
Diffstat (limited to 'test')
-rw-r--r--test/script/basic/JDK-8015355.js4
-rw-r--r--test/script/basic/JDK-8027700.js54
2 files changed, 54 insertions, 4 deletions
diff --git a/test/script/basic/JDK-8015355.js b/test/script/basic/JDK-8015355.js
index bc39d8d9..aa1a39de 100644
--- a/test/script/basic/JDK-8015355.js
+++ b/test/script/basic/JDK-8015355.js
@@ -28,10 +28,6 @@
* @run
*/
-function fail(msg) {
- print(msg);
-}
-
function check(callback) {
try {
callback();
diff --git a/test/script/basic/JDK-8027700.js b/test/script/basic/JDK-8027700.js
new file mode 100644
index 00000000..4c5445d8
--- /dev/null
+++ b/test/script/basic/JDK-8027700.js
@@ -0,0 +1,54 @@
+/*
+ * 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-8027700: function redeclaration checks missing for declaration binding instantiation
+ *
+ * @test
+ * @run
+ */
+
+Object.defineProperty(this,"x", {
+ value:0,
+ writable:true,
+ enumerable:false
+})
+
+try {
+ eval("function x() {}");
+ fail("should have thrown TypeError");
+} catch (e) {
+ if (! (e instanceof TypeError)) {
+ fail("TypeError expected but got " + e);
+ }
+}
+
+Object.defineProperty(this, "foo", { value:0 })
+try {
+ eval("function foo() {}");
+ fail("should have thrown TypeError");
+} catch (e) {
+ if (! (e instanceof TypeError)) {
+ fail("TypeError expected but got " + e);
+ }
+}