Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Side by Side Diff: test/mjsunit/strong/undefined-arrow.js

Issue 1060883004: [strong] Implement static restrictions on binding 'undefined' in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests/fix some existing test flags. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // 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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --strong-mode --harmony-arrow-functions
6 "use strict";
7
8 function CheckStrongMode(code) {
9 let strictContexts = [
10 ["'use strict';", ""],
11 ["function outer() { 'use strict';", "}"],
12 ["function outer() { 'use strict'; function inner() {", "}}"],
13 ["class C { m() {", "} }"]
14 ]
15 let strongContexts = [
16 ["'use strong';", ""],
17 ["function outer() { 'use strong';", "}"],
18 ["function outer() { 'use strong'; function inner() {", "}}"],
19 ["class C { m() { 'use strong';", "} }"]
20 ]
21
22 for (let context of strictContexts) {
23 assertDoesNotThrow(context[0] + code + context[1]);
24 }
25 for (let context of strongContexts) {
26 assertThrows(context[0] + code + context[1], SyntaxError);
27 }
28 }
29
30 CheckStrongMode("(undefined => {return});");
31 assertThrows("(undefined => {'use strong';});");
32
33 CheckStrongMode("((undefined, b, c) => {return});");
34 assertThrows("((undefined, b, c) => {'use strong';});");
35
36 CheckStrongMode("((a, undefined, c) => {return});");
37 assertThrows("((a, undefined, c) => {'use strong';});");
38
39 CheckStrongMode("((a, b, undefined) => {return});");
40 assertThrows("((a, b, undefined) => {'use strong';});");
OLDNEW
« test/cctest/test-parsing.cc ('K') | « test/mjsunit/strong/undefined.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698