##// END OF EJS Templates
Merged in propose cancellations (pull request #1)...
Merged in propose cancellations (pull request #1) Propose cancellations Approved-by: m407 <bitbucket@m407.ru>

File last commit:

r18:a8dda6a00a16 propose cancellat...
r21:dd8f8dfcd934 merge default
Show More
TraceSourceTests.ts
68 lines | 1.6 KiB | video/mp2t | TypeScriptLexer
/ test / ts / TraceSourceTests.ts
cin
added CancellationTests...
r18 import * as TraceSource 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
removed obsolete code
r12 trace.level = TraceSource.DebugLevel;
cin
added TraceSource tests
r11
cin
working on Observable
r14 let h = trace.on((ev) => {
t.equal(ev.source, trace, "sender should be the current trace source");
t.equal(ev.level, TraceSource.DebugLevel, "level should be debug level");
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);
trace.level = TraceSource.DebugLevel;
let event = {
name: "custom event"
};
cin
working on Observable
r14 let h = trace.on((ev) => {
t.equal(ev.source, trace, "sender should be the current trace source");
t.equal(ev.level, TraceSource.DebugLevel, "level should be debug level");
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();
});
trace.traceEvent(TraceSource.DebugLevel, event);
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 => {
writer.writeEvents(ts);
});
cin
working on Observable
r14
let trace = TraceSource.get(sourceId);
trace.level = TraceSource.DebugLevel;
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 });