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
66
67
68
69
70
71
72
73
74
75
76
77
78
79 | 1
1
2750
1
30
1
3721
1
982
982
962
20
13
7
1
423
1
1157
1
21
1
50
1
127
1
76
1
5
1
131
1
86
1
5
1
68
1
93
93
93
93
93
139
46
139
93
| module.exports = function (expect) {
expect.output.addStyle('error', function (content) {
this.text(content, 'red', 'bold');
});
expect.output.addStyle('success', function (content) {
this.text(content, 'green', 'bold');
});
expect.output.addStyle('strings', function (content) {
this.text(content, '#00A0A0');
});
expect.output.addStyle('key', function (content) {
content = String(content);
if (/^[a-z\$\_][a-z0-9\$\_]*$/i.test(content)) {
this.text(content, '#666');
} else if (/^(?:0|[1-9][0-9]*)$/.test(content)) {
this.number(content);
} else {
this.strings('\'')
.strings(JSON.stringify(content).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"'))
.strings('\'');
}
});
expect.output.addStyle('keyword', function (content) {
this.text(content);
});
expect.output.addStyle('number', function (content) {
this.text(content);
});
expect.output.addStyle('comment', function (content) {
this.gray(content);
});
expect.output.addStyle('regexp', function (content) {
this.green(content);
});
expect.output.addStyle('diffAddedLine', function (content) {
this.text(content, 'green');
});
expect.output.addStyle('diffAddedHighlight', function (content) {
this.text(content, 'bgGreen', 'white');
});
expect.output.addStyle('diffAddedSpecialChar', function (content) {
this.text(content, 'bgGreen', 'cyan', 'bold');
});
expect.output.addStyle('diffRemovedLine', function (content) {
this.text(content, 'red');
});
expect.output.addStyle('diffRemovedHighlight', function (content) {
this.text(content, 'bgRed', 'white');
});
expect.output.addStyle('diffRemovedSpecialChar', function (content) {
this.text(content, 'bgRed', 'cyan', 'bold');
});
// Intended to be redefined by a plugin that offers syntax highlighting:
expect.output.addStyle('code', function (content, language) {
this.text(content);
});
expect.output.addStyle('annotationBlock', function () {
var pen = this.getContentFromArguments(arguments);
var height = pen.size().height;
Eif (height > 0) {
this.block(function () {
for (var i = 0; i < height; i += 1) {
if (0 < i) {
this.nl();
}
this.error('// ');
}
});
this.block(pen);
}
});
};
|