From 2649dab2744b98d7733275a12835e127084b5cb1 Mon Sep 17 00:00:00 2001 From: AnnaMag Date: Thu, 9 Mar 2017 14:00:34 +0000 Subject: [PATCH] test: added test for indexed properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Michaƫl Zasso Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Brian White --- test/parallel/test-vm-indexed-properties.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/parallel/test-vm-indexed-properties.js diff --git a/test/parallel/test-vm-indexed-properties.js b/test/parallel/test-vm-indexed-properties.js new file mode 100644 index 00000000000000..34ef8d020b2181 --- /dev/null +++ b/test/parallel/test-vm-indexed-properties.js @@ -0,0 +1,17 @@ +'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);