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

Unified Diff: test/mjsunit/es6/block-let-declaration.js

Issue 1286923002: Add class to existing lexical scoping tests (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test bug Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/es6/block-conflicts.js ('k') | test/mjsunit/es6/block-let-semantics.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/block-let-declaration.js
diff --git a/test/mjsunit/es6/block-let-declaration.js b/test/mjsunit/es6/block-let-declaration.js
index 5fbb12824b03657dd83191b3b2e4b255139cf6bb..a138144d1857057da54bd079652770ff9414ff14 100644
--- a/test/mjsunit/es6/block-let-declaration.js
+++ b/test/mjsunit/es6/block-let-declaration.js
@@ -33,17 +33,20 @@
let x;
let y = 2;
const z = 4;
+class c { static foo() { return 1; } }
// Block local
{
let y;
let x = 3;
const z = 5;
+ class c { static foo() { return 2; } }
}
assertEquals(undefined, x);
assertEquals(2,y);
assertEquals(4,z);
+assertEquals(1, c.foo());
if (true) {
let y;
@@ -106,6 +109,16 @@ TestLocalDoesNotThrow("for (;false;) var x;");
TestLocalDoesNotThrow("switch (true) { case true: var x; }");
TestLocalDoesNotThrow("switch (true) { default: var x; }");
+// Test class declarations with initialisers in statement positions.
+TestLocalThrows("if (true) class x { };", SyntaxError);
+TestLocalThrows("if (true) {} else class x { };", SyntaxError);
+TestLocalThrows("do class x { }; while (false)", SyntaxError);
+TestLocalThrows("while (false) class x { };", SyntaxError);
+TestLocalThrows("label: class x { };", SyntaxError);
+TestLocalThrows("for (;false;) class x { };", SyntaxError);
+TestLocalDoesNotThrow("switch (true) { case true: class x { }; }");
+TestLocalDoesNotThrow("switch (true) { default: class x { }; }");
+
// Test that redeclarations of functions are only allowed in outermost scope.
TestLocalThrows("{ let f; var f; }");
TestLocalThrows("{ var f; let f; }");
@@ -113,9 +126,13 @@ TestLocalThrows("{ function f() {} let f; }");
TestLocalThrows("{ let f; function f() {} }");
TestLocalThrows("{ function f() {} var f; }");
TestLocalThrows("{ var f; function f() {} }");
+TestLocalThrows("{ function f() {} class f {} }");
+TestLocalThrows("{ class f {}; function f() {} }");
TestLocalThrows("{ function f() {} function f() {} }");
TestLocalThrows("function f() {} let f;");
TestLocalThrows("let f; function f() {}");
+TestLocalThrows("function f() {} class f {}");
+TestLocalThrows("class f {}; function f() {}");
TestLocalDoesNotThrow("function arg() {}");
TestLocalDoesNotThrow("function f() {} var f;");
TestLocalDoesNotThrow("var f; function f() {}");
« no previous file with comments | « test/mjsunit/es6/block-conflicts.js ('k') | test/mjsunit/es6/block-let-semantics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698