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

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

Issue 1018923002: Adjust key behaviour for weak collections (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/weak-collection.js ('k') | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/collections.js
diff --git a/test/mjsunit/es6/collections.js b/test/mjsunit/es6/collections.js
index 989ded8a3e0fcb342ed632f64c5b9fd8a1521d08..fe95b482a45c39c153a9f408be62ad528c74903c 100644
--- a/test/mjsunit/es6/collections.js
+++ b/test/mjsunit/es6/collections.js
@@ -51,6 +51,21 @@ function TestValidMapCalls(m) {
assertDoesNotThrow(function () { m.set(new Object) });
assertDoesNotThrow(function () { m.has(new Object) });
assertDoesNotThrow(function () { m.delete(new Object) });
+ assertDoesNotThrow(function () { m.get(undefined) });
Dmitry Lomov (no reviews) 2015/03/18 10:55:44 Validate the return value here and below
rossberg 2015/03/18 11:59:24 The actual behaviour ought to be tested further be
+ assertDoesNotThrow(function () { m.get(null) });
+ assertDoesNotThrow(function () { m.get(0) });
+ assertDoesNotThrow(function () { m.get('a-key') });
+ assertDoesNotThrow(function () { m.get(Symbol()) });
+ assertDoesNotThrow(function () { m.has(undefined) });
+ assertDoesNotThrow(function () { m.has(null) });
+ assertDoesNotThrow(function () { m.has(0) });
+ assertDoesNotThrow(function () { m.has('a-key') });
+ assertDoesNotThrow(function () { m.has(Symbol()) });
+ assertDoesNotThrow(function () { m.delete(undefined) });
+ assertDoesNotThrow(function () { m.delete(null) });
+ assertDoesNotThrow(function () { m.delete(0) });
+ assertDoesNotThrow(function () { m.delete('a-key') });
+ assertDoesNotThrow(function () { m.delete(Symbol()) });
}
TestValidMapCalls(new Map);
TestValidMapCalls(new WeakMap);
@@ -58,14 +73,11 @@ TestValidMapCalls(new WeakMap);
// Test invalid getter and setter calls for WeakMap only
function TestInvalidCalls(m) {
- assertThrows(function () { m.get(undefined) }, TypeError);
assertThrows(function () { m.set(undefined, 0) }, TypeError);
- assertThrows(function () { m.get(null) }, TypeError);
assertThrows(function () { m.set(null, 0) }, TypeError);
- assertThrows(function () { m.get(0) }, TypeError);
assertThrows(function () { m.set(0, 0) }, TypeError);
- assertThrows(function () { m.get('a-key') }, TypeError);
assertThrows(function () { m.set('a-key', 0) }, TypeError);
+ assertThrows(function () { m.set(Symbol(), 0) }, TypeError);
}
TestInvalidCalls(new WeakMap);
« no previous file with comments | « src/weak-collection.js ('k') | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698