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

Unified Diff: test/mjsunit/es6/block-scoping.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-let-semantics.js ('k') | test/mjsunit/harmony/block-conflicts-sloppy.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/block-scoping.js
diff --git a/test/mjsunit/es6/block-scoping.js b/test/mjsunit/es6/block-scoping.js
index 5f481b8bf2ebb9f87d8bc78d0972aa3097a35937..719f5231ce57cfab006be917aab9b647336f3db6 100644
--- a/test/mjsunit/es6/block-scoping.js
+++ b/test/mjsunit/es6/block-scoping.js
@@ -49,15 +49,19 @@ function f2(one) {
var x = one + 1;
let y = one + 2;
const u = one + 4;
+ class a { static foo() { return one + 6; } }
{
let z = one + 3;
const v = one + 5;
+ class b { static foo() { return one + 7; } }
assertEquals(1, eval('one'));
assertEquals(2, eval('x'));
assertEquals(3, eval('y'));
assertEquals(4, eval('z'));
assertEquals(5, eval('u'));
assertEquals(6, eval('v'));
+ assertEquals(7, eval('a.foo()'));
+ assertEquals(8, eval('b.foo()'));
}
}
@@ -68,15 +72,19 @@ function f3(one) {
var x = one + 1;
let y = one + 2;
const u = one + 4;
+ class a { static foo() { return one + 6; } }
{
let z = one + 3;
const v = one + 5;
+ class b { static foo() { return one + 7; } }
assertEquals(1, one);
assertEquals(2, x);
assertEquals(3, y);
assertEquals(4, z);
assertEquals(5, u);
assertEquals(6, v);
+ assertEquals(7, a.foo());
+ assertEquals(8, b.foo());
}
}
for (var j = 0; j < 5; ++j) f3(1);
@@ -91,9 +99,11 @@ function f4(one) {
var x = one + 1;
let y = one + 2;
const u = one + 4;
+ class a { static foo() { return one + 6; } }
{
let z = one + 3;
const v = one + 5;
+ class b { static foo() { return one + 7; } }
function f() {
assertEquals(1, eval('one'));
assertEquals(2, eval('x'));
@@ -101,6 +111,8 @@ function f4(one) {
assertEquals(4, eval('z'));
assertEquals(5, eval('u'));
assertEquals(6, eval('v'));
+ assertEquals(7, eval('a.foo()'));
+ assertEquals(8, eval('b.foo()'));
}
f();
}
@@ -113,9 +125,11 @@ function f5(one) {
var x = one + 1;
let y = one + 2;
const u = one + 4;
+ class a { static foo() { return one + 6; } }
{
let z = one + 3;
const v = one + 5;
+ class b { static foo() { return one + 7; } }
function f() {
assertEquals(1, one);
assertEquals(2, x);
@@ -123,6 +137,8 @@ function f5(one) {
assertEquals(4, z);
assertEquals(5, u);
assertEquals(6, v);
+ assertEquals(7, a.foo());
+ assertEquals(8, b.foo());
}
f();
}
@@ -149,25 +165,43 @@ function f7(a) {
var c = 1;
var d = 1;
const e = 1;
- { // let variables shadowing argument, let, const and var variables
+ class f { static foo() { return 1; } }
+ { // let variables shadowing argument, let, const, class and var variables
let a = 2;
let b = 2;
let c = 2;
let e = 2;
+ let f = 2;
assertEquals(2,a);
assertEquals(2,b);
assertEquals(2,c);
assertEquals(2,e);
+ assertEquals(2,f);
}
{ // const variables shadowing argument, let, const and var variables
const a = 2;
const b = 2;
const c = 2;
const e = 2;
+ const f = 2;
assertEquals(2,a);
assertEquals(2,b);
assertEquals(2,c);
assertEquals(2,e);
+ assertEquals(2,f);
+ }
+ { // class variables shadowing argument, let, const and var variables
+ class a { static foo() { return 2; } }
+ class b { static foo() { return 2; } }
+ class c { static foo() { return 2; } }
+ class d { static foo() { return 2; } }
+ class e { static foo() { return 2; } }
+ class f { static foo() { return 2; } }
+ assertEquals(2,a.foo());
+ assertEquals(2,b.foo());
+ assertEquals(2,c.foo());
+ assertEquals(2,e.foo());
+ assertEquals(2,f.foo());
}
try {
throw 'stuff1';
@@ -225,16 +259,18 @@ function f7(a) {
c = 2;
}
assertEquals(1,c);
- (function(a,b,c,e) {
- // arguments shadowing argument, let, const and var variable
+ (function(a,b,c,e,f) {
+ // arguments shadowing argument, let, const, class and var variable
a = 2;
b = 2;
c = 2;
e = 2;
+ f = 2;
assertEquals(2,a);
assertEquals(2,b);
assertEquals(2,c);
assertEquals(2,e);
+ assertEquals(2,f);
// var variable shadowing var variable
var d = 2;
})(1,1);
@@ -243,6 +279,7 @@ function f7(a) {
assertEquals(1,c);
assertEquals(1,d);
assertEquals(1,e);
+ assertEquals(1,f.foo());
}
f7(1);
@@ -253,19 +290,23 @@ function f8() {
var let_accessors = [];
var var_accessors = [];
var const_accessors = [];
+ var class_accessors = [];
for (var i = 0; i < 10; i++) {
let x = i;
var y = i;
const z = i;
+ class a { static foo() { return x; } }
let_accessors[i] = function() { return x; }
var_accessors[i] = function() { return y; }
const_accessors[i] = function() { return z; }
+ class_accessors[i] = function() { return a; }
}
for (var j = 0; j < 10; j++) {
y = j + 10;
assertEquals(j, let_accessors[j]());
assertEquals(y, var_accessors[j]());
assertEquals(j, const_accessors[j]());
+ assertEquals(j, class_accessors[j]().foo());
}
}
f8();
« no previous file with comments | « test/mjsunit/es6/block-let-semantics.js ('k') | test/mjsunit/harmony/block-conflicts-sloppy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698