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

Unified Diff: test/mjsunit/harmony/proxies-with-unscopables.js

Issue 1529473002: [proxies] [tests] Un-skip proxies-with-unscopables, delete proxies-symbols (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 5 years 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/harmony/proxies-symbols.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/proxies-with-unscopables.js
diff --git a/test/mjsunit/harmony/proxies-with-unscopables.js b/test/mjsunit/harmony/proxies-with-unscopables.js
index 1237b2b361041cbba35d369038067d157e82c03f..c87492c61d1dcb51447e41ef3a5871fc8f37b52b 100644
--- a/test/mjsunit/harmony/proxies-with-unscopables.js
+++ b/test/mjsunit/harmony/proxies-with-unscopables.js
@@ -5,22 +5,18 @@
// Flags: --harmony-proxies
-// TODO(arv): Once proxies can intercept symbols, add more tests.
-
-
function TestBasics() {
var log = [];
var proxy = new Proxy({}, {
- getPropertyDescriptor: function(key) {
- log.push(key);
- if (key === 'x') {
- return {
- value: 1,
- configurable: true
- };
- }
- return undefined;
+ get: function(target, key) {
+ log.push("get " + String(key));
+ if (key === 'x') return 1;
+ },
+ has: function(target, key) {
+ log.push("has " + String(key));
+ if (key === 'x') return true;
+ return false;
}
});
@@ -30,27 +26,24 @@ function TestBasics() {
assertEquals(1, x);
}
- // One 'x' for HasBinding and one for GetBindingValue
- assertEquals(['assertEquals', 'x', 'x'], log);
+ assertEquals(['has assertEquals', 'has x', 'get Symbol(Symbol.unscopables)',
+ 'get x'], log);
}
TestBasics();
function TestInconsistent() {
var log = [];
- var calls = 0;
var proxy = new Proxy({}, {
- getPropertyDescriptor: function(key) {
- log.push(key);
- if (key === 'x' && calls < 1) {
- calls++;
- return {
- value: 1,
- configurable: true
- };
- }
+ get: function(target, key) {
+ log.push("get " + String(key));
return undefined;
+ },
+ has: function(target, key) {
+ log.push("has " + String(key));
+ if (key === 'x') return true;
+ return false;
}
});
@@ -60,8 +53,8 @@ function TestInconsistent() {
assertEquals(void 0, x);
}
- // One 'x' for HasBinding and one for GetBindingValue
- assertEquals(['assertEquals', 'x', 'x'], log);
+ assertEquals(['has assertEquals', 'has x', 'get Symbol(Symbol.unscopables)',
+ 'get x'], log);
}
TestInconsistent();
@@ -73,18 +66,13 @@ function TestUseProxyAsUnscopables() {
};
var calls = 0;
var proxy = new Proxy({}, {
- has: function(key) {
+ has: function() {
assertUnreachable();
},
- getPropertyDescriptor: function(key) {
- calls++;
+ get: function(target, key) {
assertEquals('x', key);
- return {
- value: calls === 2 ? true : undefined,
- configurable: true,
- enumerable: true,
- writable: true,
- };
+ calls++;
+ return calls === 2 ? true : undefined;
}
});
@@ -111,10 +99,10 @@ function TestThrowInHasUnscopables() {
var calls = 0;
var proxy = new Proxy({}, {
- has: function(key) {
+ has: function() {
assertUnreachable();
},
- getPropertyDescriptor: function(key) {
+ get: function(target, key) {
if (calls++ === 0) {
throw new CustomError();
}
@@ -137,7 +125,10 @@ var global = this;
function TestGlobalShouldIgnoreUnscopables() {
global.x = 1;
var proxy = new Proxy({}, {
- getPropertyDescriptor: function() {
+ get: function() {
+ assertUnreachable();
+ },
+ has: function() {
assertUnreachable();
}
});
« no previous file with comments | « test/mjsunit/harmony/proxies-symbols.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698