11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// https://github.com/nodejs/node/issues/12300 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cirequire('../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst vm = require('vm'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst ctx = vm.createContext({ x: 42 }); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci// This might look as if x has not been declared, but x is defined on the 111cb0ef41Sopenharmony_ci// sandbox and the assignment should not throw. 121cb0ef41Sopenharmony_civm.runInContext('"use strict"; x = 1', ctx); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciassert.strictEqual(ctx.x, 1); 15