Skip to content

Commit c777c40

Browse files
Delta-officialannevk
authored andcommitted
Add tokenizer tests for processing instructions
1 parent 224991e commit c777c40

3 files changed

Lines changed: 204 additions & 93 deletions

File tree

‎tokenizer/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ tokens are:
7676
["StartTag", name, {attributes}]
7777
["EndTag", name]
7878
["Comment", data]
79+
["ProcessingInstruction", data]
7980
["Character", data]
8081

8182
`public_id` and `system_id` are either strings or `null`. `correctness`

‎tokenizer/test2.test‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,17 @@
183183
{ "code": "invalid-first-character-of-tag-name", "line": 1, "col": 3 }
184184
]},
185185

186-
{"description":"Simili processing instruction",
186+
{"description":"Processing instruction",
187187
"input":"<?namespace>",
188-
"output":[["Comment", "?namespace"]],
189-
"errors":[
190-
{ "code": "unexpected-question-mark-instead-of-tag-name", "line": 1, "col": 2 }
191-
]},
188+
"output":[["ProcessingInstruction", "namespace", ""]]},
192189

193-
{"description":"A bogus comment stops at >, even if preceded by two dashes",
194-
"input":"<?foo-->",
195-
"output":[["Comment", "?foo--"]],
196-
"errors":[
197-
{ "code": "unexpected-question-mark-instead-of-tag-name", "line": 1, "col": 2 }
198-
]},
190+
{"description":"A processing instruction delimited by ?> doesn't contain the delimiting ?",
191+
"input":"<?foo bar?>",
192+
"output":[["ProcessingInstruction", "foo", "bar"]]},
193+
194+
{"description":"A processing instruction's data delimited by ?> contains the correct amount of ?",
195+
"input":"<?foo bar??>",
196+
"output":[["ProcessingInstruction", "foo", "bar?"]]},
199197

200198
{"description":"Unescaped <",
201199
"input":"foo < bar",

0 commit comments

Comments
 (0)