-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-report.xsl
120 lines (117 loc) · 3.38 KB
/
test-report.xsl
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Exercises</title>
<link rel="stylesheet" type="text/css"
href="resources/css/style.css" />
<link rel="stylesheet" type="text/css"
href="resources/css/test.css" />
<meta charset="utf-8" />
</head>
<body>
<div id="content">
<div id="exercise-list">
<ul>
<li>
<a href="index.html">
<b>Overview</b>
</a>
</li>
<li>
<a href="/~https://github.com/slothsoft/exercises-javascript/">
<b>GitHub</b>
</a>
</li>
<li>
<a href="index.html?exercise=random">
<b>Random</b>
</a>
</li>
<li>
<a href="test.html">
<b>Test Results</b>
</a>
</li>
</ul>
</div>
<div id="selected-exercise">
<xsl:for-each select="testsuites">
<ul id="header-links">
<li>
<b>Runs: </b>
<xsl:value-of select="@tests - @failures - @errors" />
/
<xsl:value-of select="@tests" />
</li>
<li>
<span class="error">✘</span><b>Errors: </b>
<xsl:value-of select="@errors" />
</li>
<li>
<span class="failure">✘</span><b>Failures: </b>
<xsl:value-of select="@failures" />
</li>
</ul>
<xsl:for-each select="testsuite">
<h1>
<xsl:value-of select="@name" />
<xsl:choose>
<xsl:when test="@errors>0">
<xsl:attribute name="class">error</xsl:attribute>
</xsl:when>
<xsl:when test="@failures>0">
<xsl:attribute name="class">failure</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">success</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</h1>
<ul class="testcases">
<xsl:for-each select="testcase">
<li>
<xsl:choose>
<xsl:when test="failure">
<span class="failure">✘</span>
</xsl:when>
<xsl:when test="error">
<span class="error">✘</span>
</xsl:when>
<xsl:otherwise>
<span class="success">✔</span>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@name" />
<span class="time">
(<xsl:value-of select="@time" />s)
</span>
<xsl:choose>
<xsl:when test="failure/actual">
<ul class="horizontal-list expected-actual">
<li><b>expected: </b><xsl:value-of select="failure/expected/@value" /></li>
<li><b>actual: </b><xsl:value-of select="failure/actual/@value" /></li>
</ul>
</xsl:when>
<xsl:when test="failure/@message">
<p class="expected-actual">
<b><xsl:value-of select="failure/@type" />: </b>
<xsl:value-of select="failure/@message" />
</p>
</xsl:when>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:for-each>
</xsl:for-each>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>