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

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

Issue 147143003: ES6: Map and Set needs to normalize minus zero (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Change to use === 0 instead Created 6 years, 11 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/collection.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/collections.js
diff --git a/test/mjsunit/harmony/collections.js b/test/mjsunit/harmony/collections.js
index 04a5cdca369bddfe2d0aab63ee1e0662ba5512fd..7e95b9e110749f3b83efddef13c8c092d8adc714 100644
--- a/test/mjsunit/harmony/collections.js
+++ b/test/mjsunit/harmony/collections.js
@@ -484,3 +484,25 @@ for (var i = 9; i >= 0; i--) {
w.clear();
assertFalse(w.has(k));
})();
+
+
+(function TestMinusZeroSet() {
+ var m = new Set();
+ m.add(0);
+ m.add(-0);
+ assertEquals(1, m.size);
+ assertTrue(m.has(0));
+ assertTrue(m.has(-0));
+})();
+
+
+(function TestMinusZeroMap() {
+ var m = new Map();
+ m.set(0, 'plus');
+ m.set(-0, 'minus');
+ assertEquals(1, m.size);
+ assertTrue(m.has(0));
+ assertTrue(m.has(-0));
+ assertEquals('minus', m.get(0));
+ assertEquals('minus', m.get(-0));
+})();
« no previous file with comments | « src/collection.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698