aboutsummaryrefslogtreecommitdiff
path: root/tests/html5lib-tests/tokenizer/test1.test
blob: cb0eb48a6fc68c1c6b93f452cee792fd02dba2c9 (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
{"tests": [

{"description":"Correct Doctype lowercase",
"input":"<!DOCTYPE html>",
"output":[["DOCTYPE", "html", null, null, true]]},


{"description":"Correct Doctype uppercase",
"input":"<!DOCTYPE HTML>",
"output":[["DOCTYPE", "html", null, null, true]]},

{"description":"Correct Doctype mixed case",
"input":"<!DOCTYPE HtMl>",
"output":[["DOCTYPE", "html", null, null, true]]},

{"description":"Correct Doctype case with EOF",
"input":"<!DOCTYPE HtMl",
"output":[["DOCTYPE", "html", null, null, false]],
"errors":[
    { "code": "eof-in-doctype", "line": 1, "col": 15 }
]},

{"description":"Truncated doctype start",
"input":"<!DOC>",
"output":[["Comment", "DOC"]],
"errors":[
    { "code": "incorrectly-opened-comment", "line": 1, "col": 3 }
]},

{"description":"Doctype in error",
"input":"<!DOCTYPE foo>",
"output":[["DOCTYPE", "foo", null, null, true]]},

{"description":"Single Start Tag",
"input":"<h>",
"output":[["StartTag", "h", {}]]},

{"description":"Empty end tag",
"input":"</>",
"output":[],
"errors":[
    { "code": "missing-end-tag-name", "line": 1, "col": 3 }
]},

{"description":"Empty start tag",
"input":"<>",
"output":[["Character", "<>"]],
"errors":[
    { "code": "invalid-first-character-of-tag-name", "line": 1, "col": 2 }
]},

{"description":"Start Tag w/attribute",
"input":"<h a='b'>",
"output":[["StartTag", "h", {"a":"b"}]]},

{"description":"Start Tag w/attribute no quotes",
"input":"<h a=b>",
"output":[["StartTag", "h", {"a":"b"}]]},

{"description":"Start/End Tag",
"input":"<h></h>",
"output":[["StartTag", "h", {}], ["EndTag", "h"]]},

{"description":"Two unclosed start tags",
"input":"<p>One<p>Two",
"output":[["StartTag", "p", {}], ["Character", "One"], ["StartTag", "p", {}], ["Character", "Two"]]},

{"description":"End Tag w/attribute",
"input":"<h></h a='b'>",
"output":[["StartTag", "h", {}], ["EndTag", "h"]],
"errors":[
    { "code": "end-tag-with-attributes", "line": 1, "col": 13 }
]},

{"description":"Multiple atts",
"input":"<h a='b' c='d'>",
"output":[["StartTag", "h", {"a":"b", "c":"d"}]]},

{"description":"Multiple atts no space",
"input":"<h a='b'c='d'>",
"output":[["StartTag", "h", {"a":"b", "c":"d"}]],
"errors":[
    { "code": "missing-whitespace-between-attributes", "line": 1, "col": 9 }
]},

{"description":"Repeated attr",
 "input":"<h a='b' a='d'>",
 "output":[["StartTag", "h", {"a":"b"}]],
 "errors":[
    { "code": "duplicate-attribute", "line": 1, "col": 11 }
]},

{"description":"Simple comment",
 "input":"<!--comment-->",
 "output":[["Comment", "comment"]]},

{"description":"Comment, Central dash no space",
 "input":"<!----->",
 "output":[["Comment", "-"]]},

{"description":"Comment, two central dashes",
"input":"<!-- --comment -->",
"output":[["Comment", " --comment "]]},

{"description":"Comment, central less-than bang",
"input":"<!--<!-->",
"output":[["Comment", "<!"]]},

{"description":"Unfinished comment",
"input":"<!--comment",
"output":[["Comment", "comment"]],
"errors":[
    { "code": "eof-in-comment", "line": 1, "col": 12 }
]},

{"description":"Unfinished comment after start of nested comment",
"input":"<!-- <!--",
"output":[["Comment", " <!"]],
"errors":[
    { "code": "eof-in-comment", "line": 1, "col": 10 }
]},

{"description":"Start of a comment",
"input":"<!-",
"output":[["Comment", "-"]],
"errors":[
    { "code": "incorrectly-opened-comment", "line": 1, "col": 3 }
]},

{"description":"Short comment",
"input":"<!-->",
"output":[["Comment", ""]],
"errors":[
    { "code": "abrupt-closing-of-empty-comment", "line": 1, "col": 5 }
]},

{"description":"Short comment two",
"input":"<!--->",
"output":[["Comment", ""]],
"errors":[
    { "code": "abrupt-closing-of-empty-comment", "line": 1, "col": 6 }
]},

{"description":"Short comment three",
 "input":"<!---->",
 "output":[["Comment", ""]]},

{"description":"< in comment",
"input":"<!-- <test-->",
"output":[["Comment", " <test"]]},

{"description":"<! in comment",
"input":"<!-- <!test-->",
"output":[["Comment", " <!test"]]},

{"description":"<!- in comment",
"input":"<!-- <!-test-->",
"output":[["Comment", " <!-test"]]},

{"description":"Nested comment",
"input":"<!-- <!--test-->",
"output":[["Comment", " <!--test"]],
"errors":[
    { "code": "nested-comment", "line": 1, "col": 10 }
]},

{"description":"Nested comment with extra <",
"input":"<!-- <<!--test-->",
"output":[["Comment", " <<!--test"]],
"errors":[
    { "code": "nested-comment", "line": 1, "col": 11 }
]},

{"description":"< in script data",
"initialStates":["Script data state"],
"input":"<test-->",
"output":[["Character", "<test-->"]]},

{"description":"<! in script data",
"initialStates":["Script data state"],
"input":"<!test-->",
"output":[["Character", "<!test-->"]]},

{"description":"<!- in script data",
"initialStates":["Script data state"],
"input":"<!-test-->",
"output":[["Character", "<!-test-->"]]},

{"description":"Escaped script data",
"initialStates":["Script data state"],
"input":"<!--test-->",
"output":[["Character", "<!--test-->"]]},

{"description":"< in script HTML comment",
"initialStates":["Script data state"],
"input":"<!-- < test -->",
"output":[["Character", "<!-- < test -->"]]},

{"description":"</ in script HTML comment",
"initialStates":["Script data state"],
"input":"<!-- </ test -->",
"output":[["Character", "<!-- </ test -->"]]},

{"description":"Start tag in script HTML comment",
"initialStates":["Script data state"],
"input":"<!-- <test> -->",
"output":[["Character", "<!-- <test> -->"]]},

{"description":"End tag in script HTML comment",
"initialStates":["Script data state"],
"input":"<!-- </test> -->",
"output":[["Character", "<!-- </test> -->"]]},

{"description":"- in script HTML comment double escaped",
"initialStates":["Script data state"],
"input":"<!--<script>-</script>-->",
"output":[["Character", "<!--<script>-</script>-->"]]},

{"description":"-- in script HTML comment double escaped",
"initialStates":["Script data state"],
"input":"<!--<script>--</script>-->",
"output":[["Character", "<!--<script>--</script>-->"]]},

{"description":"--- in script HTML comment double escaped",
"initialStates":["Script data state"],
"input":"<!--<script>---</script>-->",
"output":[["Character", "<!--<script>---</script>-->"]]},

{"description":"- spaced in script HTML comment double escaped",
"initialStates":["Script data state"],
"input":"<!--<script> - </script>-->",
"output":[["Character", "<!--<script> - </script>-->"]]},

{"description":"-- spaced in script HTML comment double escaped",
"initialStates":["Script data state"],
"input":"<!--<script> -- </script>-->",
"output":[["Character", "<!--<script> -- </script>-->"]]},

{"description":"Ampersand EOF",
"input":"&",
"output":[["Character", "&"]]},

{"description":"Ampersand ampersand EOF",
"input":"&&",
"output":[["Character", "&&"]]},

{"description":"Ampersand space EOF",
"input":"& ",
"output":[["Character", "& "]]},

{"description":"Unfinished entity",
"input":"&f",
"output":[["Character", "&f"]]},

{"description":"Ampersand, number sign",
"input":"&#",
"output":[["Character", "&#"]],
"errors":[
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 3 }
]},

{"description":"Unfinished numeric entity",
"input":"&#x",
"output":[["Character", "&#x"]],
"errors":[
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 4 }
]},

{"description":"Entity with trailing semicolon (1)",
"input":"I'm &not;it",
"output":[["Character","I'm \u00ACit"]]},

{"description":"Entity with trailing semicolon (2)",
"input":"I'm &notin;",
"output":[["Character","I'm \u2209"]]},

{"description":"Entity without trailing semicolon (1)",
"input":"I'm &notit",
"output":[["Character","I'm \u00ACit"]],
"errors": [
    {"code" : "missing-semicolon-after-character-reference", "line": 1, "col": 9 }
]},

{"description":"Entity without trailing semicolon (2)",
"input":"I'm &notin",
"output":[["Character","I'm \u00ACin"]],
"errors": [
    {"code" : "missing-semicolon-after-character-reference", "line": 1, "col": 9 }
]},

{"description":"Partial entity match at end of file",
"input":"I'm &no",
"output":[["Character","I'm &no"]]},

{"description":"Non-ASCII character reference name",
"input":"&\u00AC;",
"output":[["Character", "&\u00AC;"]]},

{"description":"ASCII decimal entity",
"input":"&#0036;",
"output":[["Character","$"]]},

{"description":"ASCII hexadecimal entity",
"input":"&#x3f;",
"output":[["Character","?"]]},

{"description":"Hexadecimal entity in attribute",
"input":"<h a='&#x3f;'></h>",
"output":[["StartTag", "h", {"a":"?"}], ["EndTag", "h"]]},

{"description":"Entity in attribute without semicolon ending in x",
"input":"<h a='&notx'>",
"output":[["StartTag", "h", {"a":"&notx"}]]},

{"description":"Entity in attribute without semicolon ending in 1",
"input":"<h a='&not1'>",
"output":[["StartTag", "h", {"a":"&not1"}]]},

{"description":"Entity in attribute without semicolon ending in i",
"input":"<h a='&noti'>",
"output":[["StartTag", "h", {"a":"&noti"}]]},

{"description":"Entity in attribute without semicolon",
"input":"<h a='&COPY'>",
"output":[["StartTag", "h", {"a":"\u00A9"}]],
"errors": [
    {"code" : "missing-semicolon-after-character-reference", "line": 1, "col": 12 }
]},

{"description":"Unquoted attribute ending in ampersand",
"input":"<s o=& t>",
"output":[["StartTag","s",{"o":"&","t":""}]]},

{"description":"Unquoted attribute at end of tag with final character of &, with tag followed by characters",
"input":"<a a=a&>foo",
"output":[["StartTag", "a", {"a":"a&"}], ["Character", "foo"]]},

{"description":"plaintext element",
 "input":"<plaintext>foobar",
 "output":[["StartTag","plaintext",{}], ["Character","foobar"]]},

{"description":"Open angled bracket in unquoted attribute value state",
 "input":"<a a=f<>",
 "output":[["StartTag", "a", {"a":"f<"}]],
 "errors":[
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 7 }
]}

]}