Skip to content
Snippets Groups Projects
Commit 1efe3d2f authored by Rick Waldron's avatar Rick Waldron
Browse files

Merge pull request #419 from yanlxu/arrow-function

update tests for arrow-function
parents 03d2f68c 35038fdb
No related branches found
No related tags found
No related merge requests found
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: this binding tests
flags: [noStrict]
es6id: 14.2
---*/
function foo(){
return eval("()=>this");
}
assert.sameValue(foo()(), this, "This binding initialization was incorrect for arrow capturing this from closure.");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: this binding tests
flags: [noStrict]
es6id: 14.2
---*/
function foo(){
return eval("()=>this");
}
assert.sameValue(foo()(), this, "This binding initialization was incorrect for arrow capturing this from closure.");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: this binding tests
flags: [noStrict]
es6id: 14.2
---*/
function foo(){
return ()=>eval("this");
}
assert.sameValue(eval("foo()()"), this, "This binding initialization was incorrect for arrow capturing this from closure.");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: Capturing closure variables
es6id: 14.2
---*/
var a;
function foo(){
eval("a = 10");
return ()=>a;
}
assert.sameValue(foo()(), 10, "Closure variable was captured incorrectly.");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: Capturing closure variables - with
es6id: 14.2
flags: [noStrict]
---*/
function foo(){
var a = {a : 10};
with(a){
return () => a;
}
}
assert.sameValue(foo()(), 10, "Closure variable was captured incorrectly.");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: "ConciseBody :[lookahead { { }] AssignmentExpression"
es6id: 14.2
---*/
x => x => x
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: "ConciseBody :[lookahead { { }] AssignmentExpression"
es6id: 14.2
---*/
x => function(){}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment