21 lines
593 B
TypeScript
21 lines
593 B
TypeScript
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 {
|
|
console.warn(failures.length, "tests failedd :(")
|
|
console.log("Failed tests: ", failures.join(","))
|
|
}
|
|
}
|
|
|
|
}
|