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

Side by Side Diff: test/mjsunit/harmony/object-values.js

Issue 1581033002: [es7] implement Object.values() / Object.entries() proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Execution::ToObject() -> Object::ToObject(), test fixups Created 4 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/harmony/object-entries.js ('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 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-object-values-entries --harmony-proxies --harmony-reflect
6
7 function TestMeta() {
8 assertEquals(1, Object.values.length);
9 assertEquals(Function.prototype, Object.getPrototypeOf(Object.values));
10 }
11 TestMeta();
12
13
14 function TestBasic() {
15 var x = 16;
16 var O = {
17 d: 1,
18 c: 3,
19 [Symbol.iterator]: void 0,
20 0: 123,
21 1000: 456,
22 [x * x]: "ducks",
23 [`0x${(x * x).toString(16)}`]: "quack"
24 };
25 O.a = 2;
26 O.b = 4;
27 Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN });
28 assertEquals([123, "ducks", 456, 1, 3, "quack", 2, 4], Object.values(O));
29 assertEquals(Object.values(O), Object.keys(O).map(key => O[key]));
30 }
31 TestBasic();
32
33
34 function TestOrder() {
35 var O = {
36 a: 1,
37 [Symbol.iterator]: null
38 };
39 O[456] = 123;
40 Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN });
41
42 var log = [];
43 var P = new Proxy(O, {
44 ownKeys(target) {
45 log.push("[[OwnPropertyKeys]]");
46 return Reflect.ownKeys(target);
47 },
48 get(target, name) {
49 log.push(`[[Get]](${JSON.stringify(name)})`);
50 return Reflect.get(target, name);
51 },
52 set(target, name, value) {
53 assertUnreachable();
54 }
55 });
56
57 assertEquals([123, 1], Object.values(P));
58 assertEquals([
59 "[[OwnPropertyKeys]]",
60 "[[Get]](\"456\")",
61 "[[Get]](\"a\")"
62 ], log);
63 }
64 TestOrder();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/object-entries.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698