Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e865418

Browse filesBrowse files
conectadoMylesBorins
authored andcommitted
test: add test for a vm indexed property
Adds a single test for a vm with an indexed property. PR-URL: #23318 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent 9f4be5d commit e865418
Copy full SHA for e865418

File tree

Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-vm-context-property-forwarding.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-vm-context-property-forwarding.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,14 @@ assert.strictEqual(vm.runInContext('x;', ctx), 3);
3232
vm.runInContext('y = 4;', ctx);
3333
assert.strictEqual(sandbox.y, 4);
3434
assert.strictEqual(ctx.y, 4);
35+
36+
// Test `IndexedPropertyGetterCallback` and `IndexedPropertyDeleterCallback`
37+
const x = { get 1() { return 5; } };
38+
const pd_expected = Object.getOwnPropertyDescriptor(x, 1);
39+
const ctx2 = vm.createContext(x);
40+
const pd_actual = Object.getOwnPropertyDescriptor(ctx2, 1);
41+
42+
assert.deepStrictEqual(pd_actual, pd_expected);
43+
assert.strictEqual(ctx2[1], 5);
44+
delete ctx2[1];
45+
assert.strictEqual(ctx2[1], undefined);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.