Add tests for completion value of function / class declaration statements (#1012)

This commit is contained in:
Joseph Pecoraro 2017-05-04 08:22:28 -07:00 committed by Leo Balter
parent c1e2572143
commit 19eb1d2e02
4 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// Copyright (C) 2017 Apple Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-function-definitions-runtime-semantics-evaluation
description: Async function declaration completion value is empty.
info: >
AsyncFunctionDeclaration : async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
1. Return NormalCompletion(empty).
---*/
assert.sameValue(eval('async function f() {}'), undefined);
assert.sameValue(eval('1; async function f() {}'), 1);

View File

@ -0,0 +1,14 @@
// Copyright (C) 2017 Apple Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions-runtime-semantics-evaluation
description: Class declaration completion value is empty.
info: >
ClassDeclaration : class BindingIdentifier ClassTail
1. Perform ? BindingClassDeclarationEvaluation of this ClassDeclaration.
2. Return NormalCompletion(empty).
---*/
assert.sameValue(eval('class C {}'), undefined);
assert.sameValue(eval('1; class C {}'), 1);

View File

@ -0,0 +1,13 @@
// Copyright (C) 2017 Apple Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-function-definitions-runtime-semantics-evaluation
description: Function declaration completion value is empty.
info: >
FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
1. Return NormalCompletion(empty).
---*/
assert.sameValue(eval('function f() {}'), undefined);
assert.sameValue(eval('1; function f() {}'), 1);

View File

@ -0,0 +1,17 @@
// Copyright (C) 2017 Apple Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-statement-semantics-runtime-semantics-evaluation
description: Generator declaration completion value is empty.
info: >
GeneratorDeclaration[Yield, Await, Default]:
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
HoistableDeclaration : GeneratorDeclaration
1. Return NormalCompletion(empty).
---*/
assert.sameValue(eval('function* f() {}'), undefined);
assert.sameValue(eval('1; function* f() {}'), 1);