##// END OF EJS Templates
tests, refactoring, fixes
tests, refactoring, fixes

File last commit:

r40:6559c5b81a19 di-typescript
r40:6559c5b81a19 di-typescript
Show More
TraceSourceTests.ts
69 lines | 1.6 KiB | video/mp2t | TypeScriptLexer
/ test / ts / TraceSourceTests.ts
cin
tests, refactoring, fixes
r40 import { TraceSource, DebugLevel } from "@implab/core/log/TraceSource";
import * as tape from "tape";
import { TapeWriter } from "./TestTraits";
cin
added TraceSource tests
r11
cin
tests, refactoring, fixes
r40 const sourceId = "test/TraceSourceTests";
cin
added TraceSource tests
r11
cin
tests, refactoring, fixes
r40 tape("trace message", t => {
const trace = TraceSource.get(sourceId);
cin
added TraceSource tests
r11
cin
Code cleanup,...
r22 trace.level = DebugLevel;
cin
added TraceSource tests
r11
cin
tests, refactoring, fixes
r40 const h = trace.events.on(ev => {
cin
working on Observable
r14 t.equal(ev.source, trace, "sender should be the current trace source");
cin
Code cleanup,...
r22 t.equal(ev.level, DebugLevel, "level should be debug level");
cin
working on Observable
r14 t.equal(ev.arg, "Hello, World!", "The message should be a formatted message");
cin
removed obsolete code
r12
t.end();
cin
added TraceSource tests
r11 });
cin
removed obsolete code
r12 trace.debug("Hello, {0}!", "World");
cin
added TraceSource tests
r11 h.destroy();
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13 });
cin
tests, refactoring, fixes
r40 tape("trace event", t => {
const trace = TraceSource.get(sourceId);
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13
cin
Code cleanup,...
r22 trace.level = DebugLevel;
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13
cin
tests, refactoring, fixes
r40 const event = {
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13 name: "custom event"
};
cin
tests, refactoring, fixes
r40 const h = trace.events.on(ev => {
cin
working on Observable
r14 t.equal(ev.source, trace, "sender should be the current trace source");
cin
Code cleanup,...
r22 t.equal(ev.level, DebugLevel, "level should be debug level");
cin
working on Observable
r14 t.equal(ev.arg, event, "The message should be the specified object");
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13
t.end();
});
cin
Code cleanup,...
r22 trace.traceEvent(DebugLevel, event);
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13
h.destroy();
cin
working on Observable
r14 });
cin
tests, refactoring, fixes
r40 tape("tape comment writer", async t => {
const writer = new TapeWriter(t);
cin
fixed format-compile bug while formatting strings with new line symbols....
r15
TraceSource.on(ts => {
cin
Code cleanup,...
r22 writer.writeEvents(ts.events);
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 });
cin
working on Observable
r14
cin
tests, refactoring, fixes
r40 const trace = TraceSource.get(sourceId);
cin
Code cleanup,...
r22 trace.level = DebugLevel;
cin
working on Observable
r14
cin
tests, refactoring, fixes
r40 trace.log("Hello, {0}!", "World");
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 trace.log("Multi\n line");
cin
working on Observable
r14 trace.warn("Look at me!");
trace.error("DIE!");
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 writer.destroy();
cin
core/safe ported to typescript
r16
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 trace.log("You shouldn't see it!");
t.comment("DONE");
cin
working on Observable
r14
t.end();
cin
tests, refactoring, fixes
r40 });