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

Side by Side Diff: test/mjsunit/es6/map-set-minus-zero.js

Issue 947443005: Fix issue with -0 in Maps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
adamk 2015/02/20 19:50:04 Nit: 2015
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 var t = new Map();
adamk 2015/02/20 19:50:04 Please add a Set codepath as well.
8
9 var objectKey = {};
10 var stringKey = 'keykeykey';
11 var numberKey = 42.24;
12 var booleanKey = true;
13 var undefinedKey = undefined;
14 var nullKey = null;
15 var nanKey = NaN;
16 var zeroKey = 0;
17 var minusZeroKey = -0;
18
19
20 assertEquals(t.size, 0);
adamk 2015/02/20 19:50:04 Please invert all the assertEquals() calls in this
21
22 t.set(undefinedKey, 'value8');
23 t.set(nullKey, 'value9');
24 t.set(stringKey, 'value5');
25 t.set(numberKey, 'value6');
26 t.set(booleanKey, 'value7');
27 t.set(objectKey, 'value1');
28 t.set(nanKey, 'value10');
29 t.set(zeroKey, 'value11');
30
31 assertEquals(t.size, 8);
32
33 assertEquals(t.get(objectKey), 'value1');
34 assertEquals(t.get(stringKey), 'value5');
35 assertEquals(t.get(numberKey), 'value6');
36 assertEquals(t.get(booleanKey), 'value7');
37 assertEquals(t.get(undefinedKey), 'value8');
38 assertEquals(t.get(nullKey), 'value9');
39 assertEquals(t.get(nanKey), 'value10');
40 assertEquals(t.get(zeroKey), 'value11');
41
42 assertEquals(t.get({}), undefined);
43 assertEquals(t.get('keykeykey'), 'value5');
44 assertEquals(t.get(42.24), 'value6');
45 assertEquals(t.get(true), 'value7');
46 assertEquals(t.get(undefined), 'value8');
47 assertEquals(t.get(null), 'value9');
48 assertEquals(t.get(NaN), 'value10');
49 assertEquals(t.get(0), 'value11');
50 assertEquals(t.get(-0), 'value11');
51 assertEquals(t.get(1 / Infinity), 'value11');
52 assertEquals(t.get(-1 / Infinity), 'value11');
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698