forked from MapComplete/MapComplete
Do not show out-of-range features on speelplekken layer, fix handling of mutlipolygons in 'inside', better tests
This commit is contained in:
parent
117b0bddb1
commit
6f457a6f0d
26 changed files with 1284 additions and 770 deletions
|
@ -1,33 +1,38 @@
|
|||
|
||||
export default class T {
|
||||
|
||||
constructor(testsuite: string, tests: [string, () => void ][]) {
|
||||
let failures : string []= [];
|
||||
|
||||
public readonly failures = []
|
||||
|
||||
constructor(testsuite: string, tests: [string, () => void][]) {
|
||||
for (const [name, test] of tests) {
|
||||
try {
|
||||
test();
|
||||
} catch (e) {
|
||||
failures.push(name);
|
||||
this.failures.push(name);
|
||||
console.warn("Failed test: ", name, "because", e);
|
||||
}
|
||||
}
|
||||
if (failures.length == 0) {
|
||||
if (this.failures.length == 0) {
|
||||
console.log(`All tests of ${testsuite} done!`)
|
||||
} else {
|
||||
console.warn(failures.length, `tests of ${testsuite} failed :(`)
|
||||
console.log("Failed tests: ", failures.join(","))
|
||||
console.warn(this.failures.length, `tests of ${testsuite} failed :(`)
|
||||
console.log("Failed tests: ", this.failures.join(","))
|
||||
}
|
||||
}
|
||||
|
||||
static assertContains(needle: string, actual: string){
|
||||
if(actual.indexOf(needle) < 0){
|
||||
static assertContains(needle: string, actual: string) {
|
||||
if (actual.indexOf(needle) < 0) {
|
||||
throw `The substring ${needle} was not found`
|
||||
}
|
||||
}
|
||||
|
||||
static isTrue(b: boolean, msg: string) {
|
||||
if(!b){
|
||||
throw "Expected true, but got false: "+msg
|
||||
if (!b) {
|
||||
throw "Expected true, but got false: " + msg
|
||||
}
|
||||
}
|
||||
static isFalse(b: boolean, msg: string) {
|
||||
if (b) {
|
||||
throw "Expected false, but got true: " + msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue