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

Unified Diff: test/mjsunit/es6/unscopables.js

Issue 1045113002: ES6: Unscopable should use ToBoolean (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « src/contexts.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/unscopables.js
diff --git a/test/mjsunit/es6/unscopables.js b/test/mjsunit/es6/unscopables.js
index 03612bec533a6c51a0ffd6340ec08ef295d28e12..782dd2d7a36d800029c367cc78d8bc4c1396207d 100644
--- a/test/mjsunit/es6/unscopables.js
+++ b/test/mjsunit/es6/unscopables.js
@@ -130,25 +130,35 @@ function TestBasics(object) {
assertEquals(3, z);
}
- object[Symbol.unscopables] = {x: true};
- with (object) {
- assertEquals(1, x);
- assertEquals(5, y);
- assertEquals(3, z);
+ var truthyValues = [true, 1, 'x', {}, Symbol()];
+ for (var truthyValue of truthyValues) {
+ object[Symbol.unscopables] = {x: truthyValue};
+ with (object) {
+ assertEquals(1, x);
+ assertEquals(5, y);
+ assertEquals(3, z);
+ }
}
- object[Symbol.unscopables] = {x: 0, y: true};
- with (object) {
- assertEquals(1, x);
- assertEquals(2, y);
- assertEquals(3, z);
+ var falsyValues = [false, 0, -0, NaN, '', null, undefined];
+ for (var falsyValue of falsyValues) {
+ object[Symbol.unscopables] = {x: falsyValue, y: true};
+ with (object) {
+ assertEquals(4, x);
+ assertEquals(2, y);
+ assertEquals(3, z);
+ }
}
- object[Symbol.unscopables] = {x: 0, y: undefined};
- with (object) {
- assertEquals(1, x);
- assertEquals(5, y);
- assertEquals(3, z);
+ for (var xFalsy of falsyValues) {
+ for (var yFalsy of falsyValues) {
+ object[Symbol.unscopables] = {x: xFalsy, y: yFalsy};
+ with (object) {
+ assertEquals(4, x);
+ assertEquals(5, y);
+ assertEquals(3, z);
+ }
+ }
}
}
runTest(TestBasics);
« no previous file with comments | « src/contexts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698