| function shouldThrow(func, errorMessage) { |
| throw new Error('not thrown'); |
| if (String(error) !== errorMessage) |
| throw new Error(`bad error: ${String(error)}`); |
| function shouldBe(actual, expected) { |
| throw new Error('bad value: ' + actual); |
| class A extends Function {} |
| let a = new A("'use strict';"); |
| for (var i = 0; i < 1e6; ++i) { |
| shouldBe(typeof test(b), "object"); |
| shouldBe(typeof test({ arguments: { } }), "object"); |
| shouldBe(typeof test({ arguments: { }, hello: 42 }), "object"); |
| shouldBe(typeof test({ arguments: { }, world: 42 }), "object"); |
| shouldBe(typeof test({ arguments: { }, cocoa: 42 }), "object"); |
| shouldBe(typeof test({ arguments: { }, cappuccino: 42 }), "object"); |
| }, `TypeError: 'arguments', 'callee', and 'caller' cannot be accessed in this context.`); |