update tests for arrow-function

This commit is contained in:
unknown 2015-09-07 14:51:11 +08:00
parent 03d2f68c9c
commit 35038fdb10
7 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// 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.");

View File

@ -0,0 +1,14 @@
// 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.");

View File

@ -0,0 +1,14 @@
// 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.");

View File

@ -0,0 +1,15 @@
// 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.");

View File

@ -0,0 +1,17 @@
// 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.");

View File

@ -0,0 +1,9 @@
// 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

View File

@ -0,0 +1,9 @@
// 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(){}