We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f9c32e2 commit 8c682a3Copy full SHA for 8c682a3
test/parallel/test-regress-GH-2245.js
@@ -0,0 +1,28 @@
1
+/* eslint-disable strict */
2
+require('../common');
3
+var assert = require('assert');
4
+
5
+/*
6
+in node 0.10 a bug existed that caused strict functions to not capture
7
+their environment when evaluated. When run in 0.10 `test()` fails with a
8
+`ReferenceError`. See https://github.com/nodejs/node/issues/2245 for details.
9
+*/
10
11
+function test() {
12
13
+ var code = [
14
+ 'var foo = {m: 1};',
15
+ '',
16
+ 'function bar() {',
17
+ '\'use strict\';',
18
+ 'return foo; // foo isn\'t captured in 0.10',
19
+ '};'
20
+ ].join('\n');
21
22
+ eval(code);
23
24
+ return bar();
25
26
+}
27
28
+assert.deepEqual(test(), {m: 1});
0 commit comments