blob: 814ff93b3aad7d349a6ecd9b1aa9689ab5c49ce5 [file] [log] [blame]
//@ skip if $architecture == "mips"
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`);
}