0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-vm-indexed-properties.js
AnnaMag 1a210c4ee4 test: added test for indexed properties
Currently, indexed properties are correctly copied
onto the sandbox by CopyProperties().
This will break when CopyProperties() is removed
after adjusting NamedPropertyHandlerConfiguration
config() to use property callbacks from the new
V8 API. To fix it, we will set a config for indexed
properties.

This test is a preparation step for the patch
that removes CopyProperties().

PR-URL: https://github.com/nodejs/node/pull/11769
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-03-14 22:09:01 -07:00

18 lines
320 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const vm = require('vm');
const code = `Object.defineProperty(this, 99, {
value: 20,
enumerable: true
});`;
const sandbox = {};
const ctx = vm.createContext(sandbox);
vm.runInContext(code, ctx);
assert.strictEqual(sandbox[99], 20);