2020-08-22 17:33:08 +02:00
|
|
|
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 :(")
|
2020-08-22 17:33:08 +02:00
|
|
|
console.log("Failed tests: ", failures.join(","))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|