11cb0ef41Sopenharmony_ci/* eslint-disable strict */ 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ci// In Node.js 0.10, a bug existed that caused strict functions to not capture 51cb0ef41Sopenharmony_ci// their environment when evaluated. When run in 0.10 `test()` fails with a 61cb0ef41Sopenharmony_ci// `ReferenceError`. See https://github.com/nodejs/node/issues/2245 for details. 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst assert = require('assert'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cifunction test() { 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci const code = [ 131cb0ef41Sopenharmony_ci 'var foo = {m: 1};', 141cb0ef41Sopenharmony_ci '', 151cb0ef41Sopenharmony_ci 'function bar() {', 161cb0ef41Sopenharmony_ci '\'use strict\';', 171cb0ef41Sopenharmony_ci 'return foo; // foo isn\'t captured in 0.10', 181cb0ef41Sopenharmony_ci '};', 191cb0ef41Sopenharmony_ci ].join('\n'); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci eval(code); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci return bar(); // eslint-disable-line no-undef 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci} 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciassert.deepStrictEqual(test(), { m: 1 }); 28