Index: test/mjsunit/strong/undefined-arrow.js |
diff --git a/test/mjsunit/strong/undefined-arrow.js b/test/mjsunit/strong/undefined-arrow.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ff26ac39a65b0fa2a457e3aebe0acf44fcc0794 |
--- /dev/null |
+++ b/test/mjsunit/strong/undefined-arrow.js |
@@ -0,0 +1,40 @@ |
+// Copyright 2014 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Flags: --strong-mode --harmony-sloppy --harmony-arrow-functions |
+"use strict"; |
+ |
+function CheckStrongMode(code) { |
+ let strictContexts = [ |
+ ["'use strict';", ""], |
+ ["function outer() { 'use strict';", "}"], |
+ ["function outer() { 'use strict'; function inner() {", "}}"], |
+ ["class C { m() {", "} }"] |
+ ] |
+ let strongContexts = [ |
+ ["'use strong';", ""], |
+ ["function outer() { 'use strong';", "}"], |
+ ["function outer() { 'use strong'; function inner() {", "}}"], |
+ ["class C { m() { 'use strong';", "} }"] |
+ ] |
+ |
+ for (let context of strictContexts) { |
+ assertDoesNotThrow(context[0] + code + context[1]); |
+ } |
+ for (let context of strongContexts) { |
+ assertThrows(context[0] + code + context[1], SyntaxError); |
+ } |
+} |
+ |
+CheckStrongMode("(undefined => {return});"); |
+assertThrows("(undefined => {'use strong';});"); |
+ |
+CheckStrongMode("((undefined, b, c) => {return});"); |
+assertThrows("((undefined, b, c) => {'use strong';});"); |
+ |
+CheckStrongMode("((a, undefined, c) => {return});"); |
+assertThrows("((a, undefined, c) => {'use strong';});"); |
+ |
+CheckStrongMode("((a, b, undefined) => {return})"); |
+assertThrows("((a, b, undefined) => {'use strong';});"); |