1 |
wakaba |
1.1 |
{"tests": [ |
2 |
|
|
|
3 |
|
|
{"description":"Correct Doctype lowercase", |
4 |
|
|
"input":"<!DOCTYPE html>", |
5 |
|
|
"output":[["DOCTYPE", "HTML", false]]}, |
6 |
|
|
|
7 |
|
|
{"description":"Correct Doctype uppercase", |
8 |
|
|
"input":"<!DOCTYPE HTML>", |
9 |
|
|
"output":[["DOCTYPE", "HTML", false]]}, |
10 |
|
|
|
11 |
|
|
{"description":"Correct Doctype mixed case", |
12 |
|
|
"input":"<!DOCTYPE HtMl>", |
13 |
|
|
"output":[["DOCTYPE", "HTML", false]]}, |
14 |
|
|
|
15 |
|
|
{"description":"Truncated doctype start", |
16 |
|
|
"input":"<!DOC>", |
17 |
|
|
"output":["ParseError", ["Comment", "DOC"]]}, |
18 |
|
|
|
19 |
|
|
{"description":"Doctype in error", |
20 |
|
|
"input":"<!DOCTYPE foo>", |
21 |
|
|
"output":[["DOCTYPE", "FOO", true]]}, |
22 |
|
|
|
23 |
|
|
{"description":"Single Start Tag", |
24 |
|
|
"input":"<h>", |
25 |
|
|
"output":[["StartTag", "h", {}]]}, |
26 |
|
|
|
27 |
|
|
{"description":"Empty end tag", |
28 |
|
|
"input":"</>", |
29 |
|
|
"output":["ParseError"]}, |
30 |
|
|
|
31 |
|
|
{"description":"Empty start tag", |
32 |
|
|
"input":"<>", |
33 |
|
|
"output":["ParseError", ["Character", "<>"]]}, |
34 |
|
|
|
35 |
|
|
{"description":"Start Tag w/attribute", |
36 |
|
|
"input":"<h a='b'>", |
37 |
|
|
"output":[["StartTag", "h", {"a":"b"}]]}, |
38 |
|
|
|
39 |
|
|
{"description":"Start Tag w/attribute no quotes", |
40 |
|
|
"input":"<h a=b>", |
41 |
|
|
"output":[["StartTag", "h", {"a":"b"}]]}, |
42 |
|
|
|
43 |
|
|
{"description":"Start/End Tag", |
44 |
|
|
"input":"<h></h>", |
45 |
|
|
"output":[["StartTag", "h", {}], ["EndTag", "h"]]}, |
46 |
|
|
|
47 |
|
|
{"description":"Two unclosed start tags", |
48 |
|
|
"input":"<p>One<p>Two", |
49 |
|
|
"output":[["StartTag", "p", {}], ["Character", "One"], ["StartTag", "p", {}], ["Character", "Two"]]}, |
50 |
|
|
|
51 |
|
|
{"description":"End Tag w/attribute", |
52 |
|
|
"input":"<h></h a='b'>", |
53 |
|
|
"output":[["StartTag", "h", {}], "ParseError", ["EndTag", "h"]]}, |
54 |
|
|
|
55 |
|
|
{"description":"Multiple atts", |
56 |
|
|
"input":"<h a='b' c='d'>", |
57 |
|
|
"output":[["StartTag", "h", {"a":"b", "c":"d"}]]}, |
58 |
|
|
|
59 |
|
|
{"description":"Multiple atts no space", |
60 |
|
|
"input":"<h a='b'c='d'>", |
61 |
|
|
"output":[["StartTag", "h", {"a":"b", "c":"d"}]]}, |
62 |
|
|
|
63 |
|
|
{"description":"Repeated attr", |
64 |
|
|
"input":"<h a='b' a='d'>", |
65 |
|
|
"output":["ParseError", ["StartTag", "h", {"a":"b"}]]}, |
66 |
|
|
|
67 |
|
|
{"description":"Simple comment", |
68 |
|
|
"input":"<!--comment-->", |
69 |
|
|
"output":[["Comment", "comment"]]}, |
70 |
|
|
|
71 |
|
|
{"description":"Comment, Central dash no space", |
72 |
|
|
"input":"<!----->", |
73 |
|
|
"output":["ParseError", ["Comment", "-"]]}, |
74 |
|
|
|
75 |
|
|
{"description":"Comment, two central dashes", |
76 |
|
|
"input":"<!-- --comment -->", |
77 |
|
|
"output":["ParseError", ["Comment", " --comment "]]}, |
78 |
|
|
|
79 |
|
|
{"description":"Unfinished comment", |
80 |
|
|
"input":"<!--comment", |
81 |
|
|
"output":["ParseError", ["Comment", "comment"]]}, |
82 |
|
|
|
83 |
|
|
{"description":"Start of a comment", |
84 |
|
|
"input":"<!-", |
85 |
|
|
"output":["ParseError", ["Comment", "-"]]}, |
86 |
|
|
|
87 |
|
|
{"description":"Ampersand only", |
88 |
|
|
"input":"&", |
89 |
|
|
"output":["ParseError", ["Character", "&"]]}, |
90 |
|
|
|
91 |
|
|
{"description":"Unfinished entity", |
92 |
|
|
"input":"&f", |
93 |
|
|
"output":["ParseError", ["Character", "&"], ["Character", "f"]]}, |
94 |
|
|
|
95 |
|
|
{"description":"Ampersand, number sign", |
96 |
|
|
"input":"&#", |
97 |
|
|
"output":["ParseError", ["Character", "&"], ["Character", "#"]]}, |
98 |
|
|
|
99 |
|
|
{"description":"Unfinished numeric entity", |
100 |
|
|
"input":"&#x", |
101 |
|
|
"output":["ParseError", ["Character", "&#x"]]}, |
102 |
|
|
|
103 |
|
|
{"description":"Entity with trailing semicolon (1)", |
104 |
|
|
"input":"I'm ¬it", |
105 |
|
|
"output":[["Character","I'm ¬it"]]}, |
106 |
|
|
|
107 |
|
|
{"description":"Entity with trailing semicolon (2)", |
108 |
|
|
"input":"I'm ∉", |
109 |
|
|
"output":[["Character","I'm ∉"]]}, |
110 |
|
|
|
111 |
|
|
{"description":"Entity without trailing semicolon (1)", |
112 |
|
|
"input":"I'm ¬it", |
113 |
|
|
"output":[["Character","I'm "], "ParseError", ["Character", "¬"], |
114 |
|
|
["Character", "it"]]}, |
115 |
|
|
|
116 |
|
|
{"description":"Entity without trailing semicolon (2)", |
117 |
|
|
"input":"I'm ¬in", |
118 |
|
|
"output":[["Character","I'm "], "ParseError", ["Character", "∉"]]}, |
119 |
|
|
|
120 |
|
|
{"description":"Partial entity match at end of file", |
121 |
|
|
"input":"I'm &no", |
122 |
|
|
"output":[["Character","I'm "], "ParseError", ["Character", "&no"]]}, |
123 |
|
|
|
124 |
|
|
{"description":"ASCII decimal entity", |
125 |
|
|
"input":"$", |
126 |
|
|
"output":[["Character","$"]]}, |
127 |
|
|
|
128 |
|
|
{"description":"ASCII hexadecimal entity", |
129 |
|
|
"input":"?", |
130 |
|
|
"output":[["Character","?"]]}, |
131 |
|
|
|
132 |
|
|
{"description":"Hexadecimal entity in attribute", |
133 |
|
|
"input":"<h a='?'></h>", |
134 |
|
|
"output":[["StartTag", "h", {"a":"?"}], ["EndTag", "h"]]} |
135 |
|
|
|
136 |
|
|
]} |