|
1 | | -<!DOCTYPE html> |
2 | | -<html> |
3 | | - |
4 | | -<link rel="stylesheet" href="../../src/ui-style/ui.css"/> |
5 | | -<link rel="stylesheet" href="../../src/network/network_style.css"/> |
6 | | -<link rel="stylesheet" href="../../src/ui-scripts/tooltip/tooltip.css"/> |
7 | | - |
8 | | -<style> |
9 | | - |
10 | | -html |
11 | | -{ |
12 | | - margin: 5px; |
13 | | -} |
14 | | - |
15 | | -.type-1 { |
16 | | - color: blue; |
17 | | -} |
18 | | - |
19 | | -.type-2 { |
20 | | - color: red; |
21 | | -} |
22 | | - |
23 | | -.type-3 { |
24 | | - color: green; |
25 | | -} |
26 | | - |
27 | | -.type-4 { |
28 | | - color: #bada55; |
29 | | -} |
30 | | - |
31 | | -</style> |
32 | | - |
33 | | -<script src="../../src/scripts/dom.js"></script> |
34 | | -<script src="../../src/syntaxhighlight/http-header/tokenizer.js"></script> |
35 | | - |
| 1 | +<!doctype html> |
| 2 | +<meta charset="utf-8"> |
| 3 | +<title>Header Tokenizer</title> |
| 4 | +<link rel="stylesheet" href="qunit/qunit.css" media="screen"> |
| 5 | +<script src="qunit/qunit.js"></script> |
| 6 | +<script src="../src/lib/elementprototype.js"></script> |
| 7 | +<script src="../src/syntaxhighlight/http-header/tokenizer.js"></script> |
36 | 8 | <script> |
| 9 | +window.onload = function() { |
37 | 10 |
|
38 | 11 | var token_template = function(token) |
39 | 12 | { |
|
90 | 63 | Cache-Control:no-cache\n\ |
91 | 64 | Connection:Keep-Alive"; |
92 | 65 |
|
93 | | -window.onload = function() |
94 | | -{ |
95 | | - var headers = [raw_headers, raw_headers2, raw_headers3]; |
96 | | - headers.forEach(function(header_string){ |
97 | | - var pre = document.body.firstElementChild.render(["pre"]) |
98 | | - pre.render(get_tokens(header_string).map(token_template)); |
99 | | - if (pre.textContent !== header_string) |
100 | | - throw(new Error("Tokenized headers produced different result.")); |
101 | | - }); |
| 66 | +test("Tokenized headers", |
| 67 | + function() |
| 68 | + { |
| 69 | + var headers = [raw_headers, raw_headers2, raw_headers3]; |
| 70 | + headers.forEach(function(header_string){ |
| 71 | + var pre = document.body.firstElementChild.render(["pre"]) |
| 72 | + pre.render(get_tokens(header_string).map(token_template)); |
| 73 | + deepEqual(pre.textContent, header_string); |
| 74 | + }); |
| 75 | + } |
| 76 | +) |
102 | 77 | } |
103 | | - |
104 | 78 | </script> |
105 | 79 | <body> |
106 | | - <pre class="mono"></pre> |
| 80 | + <pre style="display: none"></pre> |
| 81 | + <h1 id="qunit-header">Dragonfly - Command Processor</h1> |
| 82 | + <h2 id="qunit-banner"></h2> |
| 83 | + <div id="qunit-testrunner-toolbar"></div> |
| 84 | + <h2 id="qunit-userAgent"></h2> |
| 85 | + <ol id="qunit-tests"></ol> |
107 | 86 | </body> |
108 | 87 | </html> |
109 | 88 |
|
0 commit comments