##// END OF EJS Templates
the documentation on observables is added...
the documentation on observables is added more tests

File last commit:

r22:93dca6f27f52 propose observables
r26:0b0a30e050ba propose observables
Show More
TraceSourceTests.ts
68 lines | 1.6 KiB | video/mp2t | TypeScriptLexer
/ test / ts / TraceSourceTests.ts
cin
Code cleanup,...
r22 import { TraceSource, DebugLevel } from '@implab/core/log/TraceSource'
cin
added TraceSource tests
r11 import * as tape from 'tape';
cin
fixed format-compile bug while formatting strings with new line symbols....
r15 import { TapeWriter } from './TestTraits';
cin
added TraceSource tests
r11
const sourceId = 'test/TraceSourceTests';
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13 tape('trace message', t => {
cin
added TraceSource tests
r11 let trace = TraceSource.get(sourceId);
cin
Code cleanup,...
r22 trace.level = DebugLevel;
cin
added TraceSource tests
r11
cin
Code cleanup,...
r22 let 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 });
tape('trace event', t => {
let trace = TraceSource.get(sourceId);
cin
Code cleanup,...
r22 trace.level = DebugLevel;
cin
refactoring, all common interfaces placed to core/interfaces.ts...
r13
let event = {
name: "custom event"
};
cin
Code cleanup,...
r22 let 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
fixed format-compile bug while formatting strings with new line symbols....
r15 tape('tape comment writer', async t => {
let writer = new TapeWriter(t);
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
let trace = TraceSource.get(sourceId);
cin
Code cleanup,...
r22 trace.level = DebugLevel;
cin
working on Observable
r14
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
added TraceSource tests
r11 });