forked from cweb/url-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
url-runner.html
110 lines (104 loc) · 3.66 KB
/
url-runner.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
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
<!doctype html>
<html>
<head>
<title>Run all URL tests</title>
<meta name="author" content="Chris Weber">
<meta name="copyright" content="© 2013 Chris Weber">
<meta name="description" content="Web browser test page for
URL parsing">
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/testharness.css">
<script src="js/testharness.js"></script>
<script src="js/testharnessreport.js"></script>
<script src="js/runner.js"></script>
</head>
<body>
<h1>Note</h1>
<p>This page is still a work in progress. TODO:</p>
<ul>
<li>Improve the expected results of each test case</li>
<li>Provide a descriptive comment with each test case</li>
<li>Reduce test cases, remove duplication</li>
<li>Implement testing for groups "normalization" and "percent-encoding"<li>
</ul>
<div id="log"></div>
</body>
<script>
// Start your engines
init();
for (var i = 0; i < data.tests.group.length; i++) {
var group = data.tests.group[i];
for (var j = 0, len = group.test.length; j < len; j++) {
var testcase = group.test[j];
if (group.name == "anchor" ||
group.name == "host" ||
group.name == "idna2008" ||
group.name == "idna2003" ||
group.name == "ipv4" ||
group.name == "ipv6" ||
group.name == "mailto" ||
group.name == "path-url" ||
group.name == "path" ||
group.name == "port" ||
group.name == "query" ||
group.name == "scheme" ||
group.name == "standard-url" ||
group.name == "whitespace"
) {
test_simple(group.name + " - " + testcase.id + ": testing \"" + testcase.url +
"\" expecting \"" + testcase.expect_url + "\"",
testcase.url,
testcase.expect_url);
}
else if (group.name == "file-http-base" ||
group.name == "file" ||
group.name == "relative-unix" ||
group.name == "relative-win" ||
group.name == "relative" ||
group.name == "trivial"
) {
test_relative(group.name + " - " + testcase.id + ": testing base \"" + testcase.base +
"\" with relative \"" + testcase.rel + "\"",
testcase.base,
testcase.rel,
testcase.expect_rel);
}
else if (group.name == "segments-from-data-url" ||
group.name == "segments" ||
group.name == "trivial-segments"
) {
test_components_relative(group.name + " - " + testcase.id + ": testing base \"" + testcase.base +
"\" with relative \"" + testcase.rel + "\"",
testcase.base,
testcase.rel,
testcase.expect_protocol,
testcase.expect_hostname,
testcase.expect_port,
testcase.expect_pathname,
testcase.expect_search,
testcase.expect_hash);
}
else if (group.name == "miscellaneous" ||
group.name == "data-scheme"
) {
test_components(group.name + " - " + testcase.id + ": testing \"" + testcase.url + "\"",
testcase.url,
testcase.expect_url,
testcase.expect_protocol,
testcase.expect_hostname,
testcase.expect_port,
testcase.expect_pathname,
testcase.expect_search,
testcase.expect_hash);
}
else if (group.name == "normalization" ||
group.name == "percent-encoding"
) {
// TODO Test these
}
}
}
</script>
</html>