@@ -28,17 +28,22 @@ const o = vm.createContext({ console });
2828
2929// Function declaration and expression should both be copied to the
3030// sandboxed context.
31- let code = 'var a = function() {};\n' ;
31+ let code = 'let a = function() {};\n' ;
3232code += 'function b(){}\n' ;
33+ code += 'var c = function() {};\n' ;
34+ code += 'var d = () => {};\n' ;
35+ code += 'let e = () => {};\n' ;
3336
3437// Grab the global b function as the completion value, to ensure that
3538// we are getting the global function, and not some other thing
3639code += '(function(){return this})().b;\n' ;
3740
3841const res = vm . runInContext ( code , o , 'test' ) ;
39-
4042assert . strictEqual ( typeof res , 'function' ) ;
4143assert . strictEqual ( res . name , 'b' ) ;
42- assert . strictEqual ( typeof o . a , 'function ' ) ;
44+ assert . strictEqual ( typeof o . a , 'undefined ' ) ;
4345assert . strictEqual ( typeof o . b , 'function' ) ;
46+ assert . strictEqual ( typeof o . c , 'function' ) ;
47+ assert . strictEqual ( typeof o . d , 'function' ) ;
48+ assert . strictEqual ( typeof o . e , 'undefined' ) ;
4449assert . strictEqual ( res , o . b ) ;
0 commit comments