##// END OF EJS Templates
Support for Function Components...
Support for Function Components Added JSX.IntrinsicElements

File last commit:

r8:6d80d7901b4c v1.0.0-rc3 default
r34:e8012fdf09ae 1.0.0-rc16 default
Show More
TestTraits.ts
60 lines | 1.9 KiB | video/mp2t | TypeScriptLexer
import { IObservable, ICancellation, IDestroyable } from "@implab/core-amd/interfaces";
import { Cancellation } from "@implab/core-amd/Cancellation";
import { TraceEvent, LogLevel, WarnLevel, DebugLevel, TraceSource } from "@implab/core-amd/log/TraceSource";
import { argumentNotNull, destroy } from "@implab/core-amd/safe";
import { TapWriter } from "./Tap";
export class TapeWriter implements IDestroyable {
private readonly _t: TapWriter;
private readonly _subscriptions = new Array<IDestroyable>();
private _destroyed = false;
constructor(t: TapWriter) {
argumentNotNull(t, "test");
this._t = t;
}
writeEvents(source: IObservable<TraceEvent>, ct: ICancellation = Cancellation.none) {
if (!this._destroyed) {
const subscription = source.on(this.writeEvent.bind(this));
if (ct.isSupported()) {
ct.register(subscription.destroy.bind(subscription));
}
this._subscriptions.push(subscription);
}
}
writeEvent(next: TraceEvent) {
if (next.level >= DebugLevel) {
this._t.comment(`DEBUG ${next.source.id} ${next}`);
} else if (next.level >= LogLevel) {
this._t.comment(`LOG ${next.source.id} ${next}`);
} else if (next.level >= WarnLevel) {
this._t.comment(`WARN ${next.source.id} ${next}`);
} else {
this._t.comment(`ERROR ${next.source.id} ${next}`);
}
}
destroy() {
if (this._destroyed)
return;
this._destroyed = true;
this._subscriptions.forEach(destroy);
}
}
type TestCallback = (ok: (msg: string) => void, fail: (msg: string) => void, trace: TraceSource) => void;
type AsyncTestCallback = (trace: TraceSource) => PromiseLike<void>;
export function test(name: string, cb: TestCallback | AsyncTestCallback) {
}
export function run() {
}