mirror of
https://github.com/tc39/test262.git
synced 2025-11-12 17:59:44 +01:00
The `negative` frontmatter tag expresses an expectation for the behavior of the test file as a whole. The `assert.throws` helper function offers more fine-grained control over expectations because it may be applied to specific statements and expressions. This makes it preferable in cases where it may be used (i.e. when the test body does not describe a syntax error or early error). Re-implement assertions for errors to use the `assert.throws` helper function wherever possible.
26 lines
723 B
JavaScript
26 lines
723 B
JavaScript
// Copyright (c) 2012 Ecma International. All rights reserved.
|
|
// Ecma International makes this code available under the terms and conditions set
|
|
// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
|
|
// "Use Terms"). Any redistribution of this code must retain the above
|
|
// copyright and this notice and otherwise comply with the Use Terms.
|
|
|
|
/*---
|
|
es5id: 15.3.5.4_2-1gs
|
|
description: >
|
|
Strict mode - checking access to strict function caller from
|
|
strict function (FunctionDeclaration defined within strict mode)
|
|
flags: [onlyStrict]
|
|
---*/
|
|
|
|
function f() {
|
|
return gNonStrict();
|
|
}
|
|
|
|
assert.throws(TypeError, function() {
|
|
f();
|
|
});
|
|
|
|
function gNonStrict() {
|
|
return gNonStrict.caller;
|
|
}
|