Coverage: forbidden extensions, bullet 1 & 2. Fixes gh-1749

This commit is contained in:
Rick Waldron 2020-09-18 16:13:40 -04:00
parent 82ee7a2cfb
commit 6a428b4a40
69 changed files with 1795 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: forbidden-extensions/bullet-one
esid: sec-forbidden-extensions
desc: >
Forbidden extension, o.arguments
info: |
ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties.
flags: [noStrict]
---*/
//- function-body
f.arguments;
//- method-body
this.method.arguments;
//- error
TypeError

View File

@ -0,0 +1,19 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: forbidden-extensions/bullet-one
esid: sec-forbidden-extensions
desc: >
Forbidden extension, o.caller
info: |
ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties.
flags: [noStrict]
---*/
//- function-body
f.caller;
//- method-body
this.method.caller;
//- error
TypeError

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: forbidden-extensions/bullet-two
esid: sec-forbidden-extensions
desc: >
Forbidden extension, o.caller
info: |
If an implementation extends any function object with an own property named "caller" the value of that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function object. If it is an accessor property, the function that is the value of the property's [[Get]] attribute must never return a strict function when called.
flags: [noStrict]
---*/
//- setup
function inner() {
// This property is forbidden from having a value that is strict function object
return inner.caller;
}
//- body
inner().toString();
//- error
TypeError

View File

@ -0,0 +1,21 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/arrow-function/
name: arrow function expression
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
info: |
ArrowFunction : ArrowParameters => ConciseBody
---*/
var callCount = 0;
var f;
f = (/*{ params }*/) => {
/*{ function-body }*/
callCount = callCount + 1;
};
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'arrow function body not evaluated');

View File

@ -0,0 +1,34 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-arrow-function/
name: async arrow function expression
esid: sec-async-arrow-function-definitions
info: |
AsyncArrowFunction :
...
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
AsyncConciseBody :
{ AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var f;
f = async (/*{ params }*/) => {
/*{ function-body }*/
callCount = callCount + 1;
};
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/async-function/
name: async function declaration
esid: sec-async-function-definitions
info: |
AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
async function f(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/named-
name: async function named expression
esid: sec-async-function-definitions
info: |
AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var f = async function f(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/nameless-
name: async function nameless expression
esid: sec-async-function-definitions
info: |
AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var f = async function(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/async-generator/
name: async generator function declaration
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
async function* f(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
}
f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-generator/
name: async generator function expression
esid: sec-asyncgenerator-definitions-evaluation
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function*(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
};
f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/async-gen-meth-
name: async generator method
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
info: |
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var obj = {
async *method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-generator/named-
name: async generator named function expression
esid: sec-asyncgenerator-definitions-evaluation
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function* g(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
};
f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/async-meth-
name: async method
esid: sec-async-function-definitions
info: |
AsyncMethod :
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var obj = {
async method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-gen-method-static/
name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
class C {
static async *method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-gen-method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
class C {
async *method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-method-static/
name: static class declaration async method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [async-functions]
flags: [async]
---*/
var callCount = 0;
class C {
static async method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-method/
name: class declaration async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
class C {
async method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/gen-method-static/
name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [generators]
---*/
var callCount = 0;
class C {
static *method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/gen-method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [generators]
---*/
var callCount = 0;
class C {
*method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/method-static/
name: static class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
---*/
var callCount = 0;
class C {
static method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/method/
name: class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
---*/
var callCount = 0;
class C {
method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-gen-method-static/
name: static class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async *method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-gen-method/
name: class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var C = class {
async *method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-method-static/
name: static class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-method/
name: class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions]
flags: [async]
---*/
var callCount = 0;
var C = class {
async method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/gen-method-static/
name: static class expression generator method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [generators]
---*/
var callCount = 0;
var C = class {
static *method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/gen-method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [generators]
---*/
var callCount = 0;
var C = class {
*method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/method-static/
name: static class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
---*/
var callCount = 0;
var C = class {
static method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
---*/
var callCount = 0;
var C = class {
method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,21 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/function/
name: function declaration
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
---*/
var callCount = 0;
function f(/*{ params }*/) {
"use strict";
/*{ function-body }*/
callCount = callCount + 1;
}
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'function body not evaluated');

View File

@ -0,0 +1,18 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/function/
name: function declaration
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
---*/
var callCount = 0;
function f(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
}
f(/*{ args }*/);
assert.sameValue(callCount, 0, 'function was evaluated');

View File

@ -0,0 +1,21 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/function/
name: function expression
esid: sec-function-definitions-runtime-semantics-evaluation
info: |
FunctionExpression : function ( FormalParameters ) { FunctionBody }
---*/
var callCount = 0;
var f;
f = function(/*{ params }*/) {
"use strict";
/*{ function-body }*/
callCount = callCount + 1;
};
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'function body not evaluated');

View File

@ -0,0 +1,19 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/function/
name: function expression
esid: sec-function-definitions-runtime-semantics-evaluation
info: |
FunctionExpression : function ( FormalParameters ) { FunctionBody }
---*/
var callCount = 0;
var f;
f = function(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
};
f(/*{ args }*/);
assert.sameValue(callCount, 1, 'function was evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/generators/
name: generator function declaration
esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
info: |
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
features: [generators]
---*/
var callCount = 0;
function* f(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
}
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'generator function body not evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/generators/
name: generator function expression
esid: sec-generator-function-definitions-runtime-semantics-evaluation
info: |
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
features: [generators]
---*/
var callCount = 0;
var f;
f = function*(/*{ params }*/) {
/*{ function-body }*/
callCount = callCount + 1;
};
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'generator function body not evaluated');

View File

@ -0,0 +1,25 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/gen-meth-
name: generator method
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
info: |
GeneratorMethod :
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
features: [generators]
---*/
var callCount = 0;
var obj = {
*method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
obj.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'generator method body not evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/meth-
name: method
esid: sec-runtime-semantics-definemethod
info: |
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
---*/
var callCount = 0;
var obj = {
method(/*{ params }*/) {
/*{ method-body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
obj.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/arrow-function/
name: arrow function expression
esid: sec-arrow-definitions-runtime-semantics-evaluation
info: |
ArrowFunction : ArrowParameters => ConciseBody
---*/
var callCount = 0;
var f;
f = (/*{ params }*/) => {
"use strict";
/*{ body }*/
callCount = callCount + 1;
};
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'arrow function body not evaluated');

View File

@ -0,0 +1,35 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-arrow-function/
name: async arrow function expression
esid: sec-async-arrow-definitions
info: |
AsyncArrowFunction :
...
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
AsyncConciseBody :
{ AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var f;
f = async (/*{ params }*/) => {
"use strict";
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/async-function/
name: async function declaration
esid: sec-async-definitions
info: |
AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
async function f(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/named-
name: async function named expression
esid: sec-async-definitions
info: |
AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var f = async function f(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-function/nameless-
name: async function nameless expression
esid: sec-async-definitions
info: |
AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var f = async function(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/async-generator/
name: async generator function declaration
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
async function* f(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,31 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-generator/
name: async generator function expression
esid: sec-asyncgenerator-definitions-evaluation
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function*(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,32 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/async-gen-meth-
name: async generator method
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
info: |
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var obj = {
async *method(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,31 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/async-generator/named-
name: async generator named function expression
esid: sec-asyncgenerator-definitions-evaluation
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function* g(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,32 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/async-meth-
name: async method
esid: sec-async-definitions
info: |
AsyncMethod :
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
var obj = {
async method(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-gen-method-static/
name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
class C {
static async *method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-gen-method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
class C {
async *method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-method-static/
name: static class declaration async method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [async-functions]
flags: [async]
---*/
var callCount = 0;
class C {
static async method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/async-method/
name: class declaration async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
flags: [async]
features: [async-functions]
---*/
var callCount = 0;
class C {
async method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/gen-method-static/
name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [generators]
---*/
var callCount = 0;
class C {
static *method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/gen-method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
features: [generators]
---*/
var callCount = 0;
class C {
*method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/method-static/
name: static class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
---*/
var callCount = 0;
class C {
static method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/method/
name: class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: |
ClassDeclaration : class BindingIdentifier ClassTail
---*/
var callCount = 0;
class C {
method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
}
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-gen-method-static/
name: static class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async *method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-gen-method/
name: class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration]
flags: [async]
---*/
var callCount = 0;
var C = class {
async *method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-method-static/
name: static class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/async-method/
name: class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions]
flags: [async]
---*/
var callCount = 0;
var C = class {
async method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated');
}, $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/gen-method-static/
name: static class expression generator method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [generators]
---*/
var callCount = 0;
var C = class {
static *method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/gen-method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
features: [generators]
---*/
var callCount = 0;
var C = class {
*method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/method-static/
name: static class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
---*/
var callCount = 0;
var C = class {
static method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/method/
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
info: |
ClassExpression : class BindingIdentifieropt ClassTail
---*/
var callCount = 0;
var C = class {
method(/*{ params }*/) {
/* implicit strict */
/*{ body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,21 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/function/
name: function declaration
esid: sec-definitions-runtime-semantics-instantiatefunctionobject
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
---*/
var callCount = 0;
function f(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,21 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/function/
name: function expression
esid: sec-definitions-runtime-semantics-evaluation
info: |
FunctionExpression : function ( FormalParameters ) { FunctionBody }
---*/
var callCount = 0;
var f;
f = function(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
};
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/generators/
name: generator function declaration
esid: sec-generator-definitions-runtime-semantics-instantiatefunctionobject
info: |
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
features: [generators]
---*/
var callCount = 0;
function* f(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'generator function body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/generators/
name: generator function expression
esid: sec-generator-definitions-runtime-semantics-evaluation
info: |
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
features: [generators]
---*/
var callCount = 0;
var f;
f = function*(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
};
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'generator function body not evaluated');

View File

@ -0,0 +1,26 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/gen-meth-
name: generator method
esid: sec-generator-definitions-runtime-semantics-propertydefinitionevaluation
info: |
GeneratorMethod :
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
features: [generators]
---*/
var callCount = 0;
var obj = {
*method(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
obj.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'generator method body not evaluated');

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/meth-
name: method
esid: sec-runtime-semantics-definemethod
info: |
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
---*/
var callCount = 0;
var obj = {
method(/*{ params }*/) {
"use strict";
/*{ body }*/
callCount = callCount + 1;
}
};
assert.throws(/*{ error }*/, function() {
obj.method(/*{ args }*/);
});
assert.sameValue(callCount, 0, 'method body not evaluated');