mirror of
https://github.com/tc39/test262.git
synced 2025-11-16 11:49:45 +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.
25 lines
810 B
JavaScript
25 lines
810 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-71gs
|
|
description: >
|
|
Strict mode - checking access to strict function caller from
|
|
non-strict function (strict function declaration called by
|
|
Function.prototype.bind(null)())
|
|
flags: [noStrict]
|
|
---*/
|
|
|
|
function f() { "use strict"; return gNonStrict();};
|
|
|
|
assert.throws(TypeError, function() {
|
|
f.bind(null)();
|
|
});
|
|
|
|
function gNonStrict() {
|
|
return gNonStrict.caller || gNonStrict.caller.throwTypeError;
|
|
}
|