test262/test/built-ins/Function/15.3.5.4_2-1gs.js
Mike Pennisi 10e0d977ec Prefer explicit error checking where possible
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.
2015-07-10 14:12:57 -04:00

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;
}