1/* eslint-disable strict */
2require('../common');
3
4// In Node.js 0.10, a bug existed that caused strict functions to not capture
5// their environment when evaluated. When run in 0.10 `test()` fails with a
6// `ReferenceError`. See https://github.com/nodejs/node/issues/2245 for details.
7
8const assert = require('assert');
9
10function test() {
11
12  const code = [
13    'var foo = {m: 1};',
14    '',
15    'function bar() {',
16    '\'use strict\';',
17    'return foo; // foo isn\'t captured in 0.10',
18    '};',
19  ].join('\n');
20
21  eval(code);
22
23  return bar(); // eslint-disable-line no-undef
24
25}
26
27assert.deepStrictEqual(test(), { m: 1 });
28