-
Notifications
You must be signed in to change notification settings - Fork 7
/
coverageTemplate.html
82 lines (71 loc) · 1.84 KB
/
coverageTemplate.html
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
80
81
82
<html>
<head>
<script>
var gCovData = $COV_DATA;
</script>
<style>
.not_covered {
background-color: red;
}
.covered {
background-color: green;
}
.disabled {
background-color: gray;
}
</style>
</head>
<body>
<script>
function createTabs() {
var first = true;
for (var i in gCovData) {
if (first)
first = false;
else
document.write(" | ");
var a = document.createElement("a");
a.innerHTML = i;
a.href = "javascript:printCoverageDataForFile('" + i + "')";
document.body.appendChild(a);
}
}
function printCoverageDataForFile(fileName) {
var oldTbl = document.getElementById("source-view");
if (oldTbl != null)
document.body.removeChild(oldTbl);
var tbl = document.createElement("table");
document.body.appendChild(tbl);
tbl.id = "source-view";
var lines = gCovData[fileName].s.match(/.*[\n\r]?/g);
for (var i = 0; i < lines.length; ++i) {
var tr = document.createElement("tr");
tbl.appendChild(tr);
var passes = gCovData[fileName].l[i + 1];
if (passes == 0) {
tr.className = "not_covered";
}
else if (passes > 0) {
tr.className = "covered";
}
else {
tr.className = "disabled";
}
var td = document.createElement("td");
td.innerHTML = i + 1;
tr.appendChild(td);
td = document.createElement("td");
td.innerHTML = "<pre>" + lines[i] + "</pre>";
tr.appendChild(td);
td = document.createElement("td");
if (passes != -1 && passes != undefined) {
td.innerHTML = passes;
}
tr.appendChild(td);
}
}
createTabs();
//printCoverageDataForFile("test.nim");
</script>
</body>
</html>