mirror of https://github.com/tc39/test262.git
update tests for arrow-function
This commit is contained in:
parent
03d2f68c9c
commit
35038fdb10
|
@ -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.");
|
|
@ -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.");
|
|
@ -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.");
|
|
@ -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.");
|
|
@ -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.");
|
|
@ -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
|
|
@ -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(){}
|
Loading…
Reference in New Issue