34 lines
670 B
JavaScript
34 lines
670 B
JavaScript
function shouldBe(actual, expected) {
|
|
if (actual !== expected)
|
|
throw new Error('bad value: ' + actual);
|
|
}
|
|
|
|
try {
|
|
(function () {
|
|
throw new Error("ok");
|
|
}());
|
|
} catch (error) {
|
|
for (let line of error.stack.split('\n'))
|
|
shouldBe(line.includes('@'), true);
|
|
}
|
|
|
|
try {
|
|
eval(`
|
|
throw new Error("ok");
|
|
`);
|
|
} catch (error) {
|
|
for (let line of error.stack.split('\n'))
|
|
shouldBe(line.includes('@'), true);
|
|
}
|
|
|
|
try {
|
|
eval(`
|
|
(function () {
|
|
throw new Error("ok");
|
|
}());
|
|
`);
|
|
} catch (error) {
|
|
for (let line of error.stack.split('\n'))
|
|
shouldBe(line.includes('@'), true);
|
|
}
|