now has working leak detection

This commit is contained in:
2017-10-10 17:14:14 +02:00
parent f2eddb169f
commit 6c960f9fbd
9 changed files with 88 additions and 27 deletions

View File

@ -20,7 +20,7 @@ export class Tap {
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
async test(testDescription: string, testFunction: ITestFunction) {
async test (testDescription: string, testFunction: ITestFunction) {
let localTest = new TapTest({
description: testDescription,
testFunction: testFunction,
@ -33,7 +33,7 @@ export class Tap {
/**
* wraps function
*/
wrap(functionArg: ITapWrapFunction) {
wrap (functionArg: ITapWrapFunction) {
return new TapWrap(functionArg)
}
@ -42,7 +42,7 @@ export class Tap {
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testParallel(testDescription: string, testFunction: ITestFunction) {
testParallel (testDescription: string, testFunction: ITestFunction) {
this._tapTests.push(new TapTest({
description: testDescription,
testFunction: testFunction,
@ -50,15 +50,6 @@ export class Tap {
}))
}
/**
* tests leakage
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testLeakage(testDescription: string, testFunction: ITestFunction) {
}
/**
* starts the test evaluation
*/

View File

@ -1,6 +1,10 @@
import * as plugins from './tapbundle.plugins'
import { TapTest } from './tapbundle.classes.taptest'
export interface IPromiseFunc {
(): Promise<any>
}
export class TapTools {
/**
@ -26,6 +30,10 @@ export class TapTools {
await plugins.smartdelay.delayFor(timeMilliArg)
}
async delayForRandom (timeMilliMinArg, timeMilliMaxArg) {
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg)
}
async timeout (timeMilliArg: number) {
let timeout = new plugins.smartdelay.Timeout(timeMilliArg)
timeout.makeUnrefed()
@ -35,4 +43,17 @@ export class TapTools {
}
}
async checkIterationLeak (iterationfuncArg: IPromiseFunc) {
await plugins.leakage.iterate.async(iterationfuncArg)
}
async returnError (throwingFuncArg: IPromiseFunc) {
let funcErr: Error
try {
await throwingFuncArg()
} catch (err) {
funcErr = err
}
return funcErr
}
}