-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathLogTracer.js
65 lines (57 loc) · 1.48 KB
/
LogTracer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import test from 'ava';
import Tester from './helpers/Tester';
import { LogTracer } from '..';
test('LogTracer', new Tester(execute => {
let tracer;
let key;
execute([
tracer = new LogTracer('Test Tracer'),
key = tracer.key,
],
{ key, method: 'LogTracer', args: ['Test Tracer'] },
);
execute([
tracer.destroy(),
],
{ key, method: 'destroy', args: [] },
);
execute([
tracer.print('hello world'),
tracer.print(123),
tracer.print('\t\t\n'),
],
{ key, method: 'print', args: ['hello world'] },
{ key, method: 'print', args: [123] },
{ key, method: 'print', args: ['\t\t\n'] },
);
execute([
tracer.printf('hello world'),
tracer.printf('my name is %s.\n', 'jason'),
tracer.printf('%d', 42),
],
{ key, method: 'printf', args: ['hello world'] },
{ key, method: 'printf', args: ['my name is %s.\n', 'jason'] },
{ key, method: 'printf', args: ['%d', 42] },
);
execute([
tracer.println('hello world'),
tracer.println(123),
tracer.println('\t\t\n'),
],
{ key, method: 'println', args: ['hello world'] },
{ key, method: 'println', args: [123] },
{ key, method: 'println', args: ['\t\t\n'] },
);
execute([
tracer.reset(),
],
{ key, method: 'reset', args: [] },
);
execute([
tracer.set('hello world'),
tracer.set(),
],
{ key, method: 'set', args: ['hello world'] },
{ key, method: 'set', args: [] },
);
}).test);