blob: b95b3173775e17fc9f81d96457dec80c894cc319 [file] [log] [blame]
function shouldThrow(func, errorMessage) {
var errorThrown = false;
var error = null;
try {
func();
} catch (e) {
errorThrown = true;
error = e;
}
if (!errorThrown)
throw new Error('not thrown');
if (String(error) !== errorMessage)
throw new Error(`bad error: ${String(error)}`);
}
noInline(shouldThrow);
for (var i = 0; i < 1e5; ++i) {
shouldThrow(() => {
new (class extends Array { static get [Symbol.species]() { return makeMasquerader(); } })(1, 2, 3).flat().constructor
}, `TypeError: Species construction did not get a valid constructor`);
}