TraceSourceTests.ts
21 lines
| 611 B
| video/mp2t
|
TypeScriptLexer
|
|
r11 | import * as TraceSource from '@implab/core/log/TraceSource' | |
| import * as tape from 'tape'; | |||
| const sourceId = 'test/TraceSourceTests'; | |||
| tape('', t => { | |||
| let trace = TraceSource.get(sourceId); | |||
|
|
r12 | trace.level = TraceSource.DebugLevel; | |
|
|
r11 | ||
|
|
r12 | let h = trace.on((sender,level,msg) => { | |
| t.equal(sender, trace, "sender should be the current trace source"); | |||
| t.equal(TraceSource.DebugLevel, level, "level should be debug level"); | |||
| t.equal(msg, "Hello, World!", "The message should be formatted correctly"); | |||
| t.end(); | |||
|
|
r11 | }); | |
|
|
r12 | trace.debug("Hello, {0}!", "World"); | |
|
|
r11 | h.destroy(); | |
| }); |
