mapcomplete/test/TestHelper.ts

22 lines
592 B
TypeScript
Raw Normal View History

export default class T {
constructor(tests: [string, () => void ][]) {
let failures : string []= [];
for (const [name, test] of tests) {
try {
test();
} catch (e) {
failures.push(name);
console.warn("Failed test: ", name, "because", e);
}
}
if (failures.length == 0) {
console.log("All tests done!")
} else {
2020-10-06 01:37:02 +02:00
console.warn(failures.length, "tests failed :(")
console.log("Failed tests: ", failures.join(","))
}
}
}