Chromium Code Reviews| 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..ea2e9a18bdc53618973a1be0854ad2d9cb644042 |
| --- /dev/null |
| +++ b/test/mjsunit/strong/undefined-arrow.js |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2014 the V8 project authors. All rights reserved. |
|
rossberg
2015/04/10 14:02:56
Nit: I'd prefer to keep these tests in the main fi
conradw
2015/04/10 14:20:49
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Flags: --strong-mode --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';});"); |