MCPcopy Create free account
hub / github.com/nodejs/node / testProperties

Function testProperties

deps/v8/test/mjsunit/wasm/user-properties-common.js:12–42  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

10let globalCounter = 10000000;
11
12function testProperties(obj) {
13 for (let i = 0; i < 3; i++) {
14 obj.x = 1001;
15 assertEquals(1001, obj.x);
16
17 obj.y = "old";
18 assertEquals("old", obj.y);
19
20 delete obj.y;
21 assertEquals("undefined", typeof obj.y);
22
23 let uid = globalCounter++;
24 let fresh = "f_" + uid;
25
26 obj.z = fresh;
27 assertEquals(fresh, obj.z);
28
29 obj[fresh] = uid;
30 assertEquals(uid, obj[fresh]);
31
32 verifyHeap();
33
34 assertEquals(1001, obj.x);
35 assertEquals(fresh, obj.z);
36 assertEquals(uid, obj[fresh]);
37 }
38
39 // These properties are special for JSFunctions.
40 Object.defineProperty(obj, 'name', {value: "crazy"});
41 Object.defineProperty(obj, 'length', {value: 999});
42}
43
44function minus18(x) { return x - 18; }
45function id(x) { return x; }

Calls 2

assertEqualsFunction · 0.50
definePropertyMethod · 0.45

Tested by

no test coverage detected