<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jmdyck</id>
	<title>WHATWG Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jmdyck"/>
	<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/wiki/Special:Contributions/Jmdyck"/>
	<updated>2026-05-23T03:32:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9293</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9293"/>
		<updated>2013-08-31T19:27:51Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Tokenizer Tests */ Add section for xmlViolation tests&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
     {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
     &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
     &amp;quot;output&amp;quot;:[expected_output_tokens],&lt;br /&gt;
     &amp;quot;initialStates&amp;quot;:[initial_states],&lt;br /&gt;
     &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
     &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
     }&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.input&amp;lt;/tt&amp;gt; is a string containing the characters to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;tt&amp;gt;test.doubleEscaped&amp;lt;/tt&amp;gt; is present and &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, then &amp;lt;tt&amp;gt;test.input&amp;lt;/tt&amp;gt; is not quite as described above.&lt;br /&gt;
Instead, it must first be subjected to another round of unescaping (i.e., in addition to any unescaping involved in the JSON import), and the result of &#039;&#039;that&#039;&#039; represents the characters of the input stream.&lt;br /&gt;
Currently, the only unescaping required by this option is to convert each sequence of the form \uHHHH (where H is a hex digit) into the corresponding Unicode code point.&lt;br /&gt;
(Note that this option also affects the interpretation of &amp;lt;tt&amp;gt;test.output&amp;lt;/tt&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.initialStates&amp;lt;/tt&amp;gt; is a list of strings, each being the name of a tokenizer state.&lt;br /&gt;
The test should be run once for each string, using it to set the tokenizer&#039;s initial state for that run.&lt;br /&gt;
If &amp;lt;tt&amp;gt;test.initialStates&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;data state&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.lastStartTag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag to have been emitted from this tokenizer&amp;quot;, referenced in the spec&#039;s definition of &#039;&#039;&#039;appropriate end tag token&#039;&#039;&#039;. If it is omitted, it is treated as if &amp;quot;no start tag has been emitted from this tokenizer&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.output&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;tt&amp;gt;test.doubleEscaped&amp;lt;/tt&amp;gt; is present and &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, then every string within &amp;lt;tt&amp;gt;test.output&amp;lt;/tt&amp;gt; must be further unescaped (as described above) before comparing with the tokenizer&#039;s output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.ignoreErrorOrder&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== xmlViolation tests ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;tokenizer/xmlViolation.test&amp;lt;/tt&amp;gt; differs from the above in a couple of ways:&lt;br /&gt;
* The name of the single member of the top-level JSON object is &amp;quot;xmlViolationTests&amp;quot; instead of &amp;quot;tests&amp;quot;.&lt;br /&gt;
* Each test&#039;s expected output assumes that implementation is applying the tweaks given in the spec&#039;s &amp;quot;Coercing an HTML DOM into an infoset&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9292</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9292"/>
		<updated>2013-08-31T19:13:00Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Basic Structure */ describe &amp;#039;doubleEscaped&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
     {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
     &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
     &amp;quot;output&amp;quot;:[expected_output_tokens],&lt;br /&gt;
     &amp;quot;initialStates&amp;quot;:[initial_states],&lt;br /&gt;
     &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
     &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
     }&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.input&amp;lt;/tt&amp;gt; is a string containing the characters to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;tt&amp;gt;test.doubleEscaped&amp;lt;/tt&amp;gt; is present and &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, then &amp;lt;tt&amp;gt;test.input&amp;lt;/tt&amp;gt; is not quite as described above.&lt;br /&gt;
Instead, it must first be subjected to another round of unescaping (i.e., in addition to any unescaping involved in the JSON import), and the result of &#039;&#039;that&#039;&#039; represents the characters of the input stream.&lt;br /&gt;
Currently, the only unescaping required by this option is to convert each sequence of the form \uHHHH (where H is a hex digit) into the corresponding Unicode code point.&lt;br /&gt;
(Note that this option also affects the interpretation of &amp;lt;tt&amp;gt;test.output&amp;lt;/tt&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.initialStates&amp;lt;/tt&amp;gt; is a list of strings, each being the name of a tokenizer state.&lt;br /&gt;
The test should be run once for each string, using it to set the tokenizer&#039;s initial state for that run.&lt;br /&gt;
If &amp;lt;tt&amp;gt;test.initialStates&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;data state&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.lastStartTag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag to have been emitted from this tokenizer&amp;quot;, referenced in the spec&#039;s definition of &#039;&#039;&#039;appropriate end tag token&#039;&#039;&#039;. If it is omitted, it is treated as if &amp;quot;no start tag has been emitted from this tokenizer&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.output&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;tt&amp;gt;test.doubleEscaped&amp;lt;/tt&amp;gt; is present and &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, then every string within &amp;lt;tt&amp;gt;test.output&amp;lt;/tt&amp;gt; must be further unescaped (as described above) before comparing with the tokenizer&#039;s output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.ignoreErrorOrder&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9291</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9291"/>
		<updated>2013-08-31T18:53:24Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Tokenizer Tests */ I think it&amp;#039;s confusing to refer to a component of a test using an identifier that isn&amp;#039;t the component&amp;#039;s actual name, so eliminate that.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
     {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
     &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
     &amp;quot;output&amp;quot;:[expected_output_tokens],&lt;br /&gt;
     &amp;quot;initialStates&amp;quot;:[initial_states],&lt;br /&gt;
     &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
     &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
     }&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.input&amp;lt;/tt&amp;gt; is a string containing the characters to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.initialStates&amp;lt;/tt&amp;gt; is a list of strings, each being the name of a tokenizer state.&lt;br /&gt;
The test should be run once for each string, using it to set the tokenizer&#039;s initial state for that run.&lt;br /&gt;
If &amp;lt;tt&amp;gt;test.initialStates&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;data state&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.lastStartTag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag to have been emitted from this tokenizer&amp;quot;, referenced in the spec&#039;s definition of &#039;&#039;&#039;appropriate end tag token&#039;&#039;&#039;. If it is omitted, it is treated as if &amp;quot;no start tag has been emitted from this tokenizer&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.output&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;test.ignoreErrorOrder&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9290</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9290"/>
		<updated>2013-08-31T18:40:47Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Test set-up */ make a stronger association between lastStartTag and the spec&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
     {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
     &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
     &amp;quot;output&amp;quot;:[expected_output_tokens],&lt;br /&gt;
     &amp;quot;initialStates&amp;quot;:[initial_states],&lt;br /&gt;
     &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
     &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
     }&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;initial_states&amp;lt;/tt&amp;gt; is a list of strings, each being the name of a tokenizer state.&lt;br /&gt;
The test should be run once for each string, using it to set the tokenizer&#039;s initial state for that run.&lt;br /&gt;
If &amp;lt;tt&amp;gt;initial_states&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;data state&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag to have been emitted from this tokenizer&amp;quot;, referenced in the spec&#039;s definition of &#039;&#039;&#039;appropriate end tag token&#039;&#039;&#039;. If it is omitted, it is treated as if &amp;quot;no start tag has been emitted from this tokenizer&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9289</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9289"/>
		<updated>2013-08-31T18:35:07Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Basic Structure */ replace &amp;#039;contentModelFlags&amp;#039; with &amp;#039;initialStates&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
     {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
     &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
     &amp;quot;output&amp;quot;:[expected_output_tokens],&lt;br /&gt;
     &amp;quot;initialStates&amp;quot;:[initial_states],&lt;br /&gt;
     &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
     &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
     }&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;initial_states&amp;lt;/tt&amp;gt; is a list of strings, each being the name of a tokenizer state.&lt;br /&gt;
The test should be run once for each string, using it to set the tokenizer&#039;s initial state for that run.&lt;br /&gt;
If &amp;lt;tt&amp;gt;initial_states&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;data state&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag token emitted&amp;quot; in the tokenizer algorithm. If it is omitted, it is treated as if &amp;quot;no start tag token has ever been emitted by this instance of the tokeniser&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9288</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9288"/>
		<updated>2013-08-31T18:26:40Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Basic Structure */ fix typo: misplaced right-brace&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
     {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
     &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
     &amp;quot;output&amp;quot;:[expected_output_tokens],&lt;br /&gt;
     &amp;quot;contentModelFlags&amp;quot;:[content_model_flags],&lt;br /&gt;
     &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
     &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
     }&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is a list of strings from the set:&lt;br /&gt;
 PCDATA&lt;br /&gt;
 RCDATA&lt;br /&gt;
 RAWTEXT&lt;br /&gt;
 PLAINTEXT&lt;br /&gt;
The test case applies when the tokenizer begins with its content model flag set to any of those values. If &amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;PCDATA&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag token emitted&amp;quot; in the tokenizer algorithm. If it is omitted, it is treated as if &amp;quot;no start tag token has ever been emitted by this instance of the tokeniser&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9287</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9287"/>
		<updated>2013-08-31T18:25:35Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Basic Structure */ Indent the JSON code for readability.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
     {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
     &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
     &amp;quot;output&amp;quot;:[expected_output_tokens]},&lt;br /&gt;
     &amp;quot;contentModelFlags&amp;quot;:[content_model_flags],&lt;br /&gt;
     &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
     &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is a list of strings from the set:&lt;br /&gt;
 PCDATA&lt;br /&gt;
 RCDATA&lt;br /&gt;
 RAWTEXT&lt;br /&gt;
 PLAINTEXT&lt;br /&gt;
The test case applies when the tokenizer begins with its content model flag set to any of those values. If &amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;PCDATA&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag token emitted&amp;quot; in the tokenizer algorithm. If it is omitted, it is treated as if &amp;quot;no start tag token has ever been emitted by this instance of the tokeniser&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9286</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9286"/>
		<updated>2013-08-30T22:44:12Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Basic Structure */ Rearrange paragraphs more logically. Add headers &amp;quot;Test set-up&amp;quot; and &amp;quot;Test results&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
 {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
 &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
 &amp;quot;output&amp;quot;:[expected_output_tokens]},&lt;br /&gt;
 &amp;quot;contentModelFlags&amp;quot;:[content_model_flags],&lt;br /&gt;
 &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
 &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
===Test set-up===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is a list of strings from the set:&lt;br /&gt;
 PCDATA&lt;br /&gt;
 RCDATA&lt;br /&gt;
 RAWTEXT&lt;br /&gt;
 PLAINTEXT&lt;br /&gt;
The test case applies when the tokenizer begins with its content model flag set to any of those values. If &amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;PCDATA&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag token emitted&amp;quot; in the tokenizer algorithm. If it is omitted, it is treated as if &amp;quot;no start tag token has ever been emitted by this instance of the tokeniser&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Test results===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9279</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9279"/>
		<updated>2013-08-28T23:02:32Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Basic Structure */ Clarify &amp;quot;input_string&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
 {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
 &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
 &amp;quot;output&amp;quot;:[expected_output_tokens]},&lt;br /&gt;
 &amp;quot;contentModelFlags&amp;quot;:[content_model_flags],&lt;br /&gt;
 &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
 &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
Specifically, it represents the characters of the &#039;&#039;&#039;input stream&#039;&#039;&#039;, and so implementations are expected to perform the processing described in the spec&#039;s &#039;&#039;&#039;Preprocessing the input stream&#039;&#039;&#039; section before feeding the result to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is a list of strings from the set:&lt;br /&gt;
 PCDATA&lt;br /&gt;
 RCDATA&lt;br /&gt;
 RAWTEXT&lt;br /&gt;
 PLAINTEXT&lt;br /&gt;
The test case applies when the tokenizer begins with its content model flag set to any of those values. If &amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;PCDATA&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag token emitted&amp;quot; in the tokenizer algorithm. If it is omitted, it is treated as if &amp;quot;no start tag token has ever been emitted by this instance of the tokeniser&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9278</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9278"/>
		<updated>2013-08-28T22:26:46Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: Describe + link to the tests repository before saying how this page relates to it.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib/html5lib-tests html5lib-tests] is a suite of unit tests for use by implementations of the HTML5 parsing spec.&lt;br /&gt;
The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
This page documents the various test formats that are used within the suite.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
 {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
 &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
 &amp;quot;output&amp;quot;:[expected_output_tokens]},&lt;br /&gt;
 &amp;quot;contentModelFlags&amp;quot;:[content_model_flags],&lt;br /&gt;
 &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
 &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is a list of strings from the set:&lt;br /&gt;
 PCDATA&lt;br /&gt;
 RCDATA&lt;br /&gt;
 RAWTEXT&lt;br /&gt;
 PLAINTEXT&lt;br /&gt;
The test case applies when the tokenizer begins with its content model flag set to any of those values. If &amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;PCDATA&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag token emitted&amp;quot; in the tokenizer algorithm. If it is omitted, it is treated as if &amp;quot;no start tag token has ever been emitted by this instance of the tokeniser&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9277</id>
		<title>Parser tests</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Parser_tests&amp;diff=9277"/>
		<updated>2013-08-28T22:22:17Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: Remove an unnecessary level of grouping.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the unit-test format(s) being used for implementations of the HTML5 parsing spec. The aim is to produce implementation-independent, self-describing tests that can be shared between any groups working on these technologies.&lt;br /&gt;
&lt;br /&gt;
=Tokenizer Tests=&lt;br /&gt;
The test format is [http://www.json.org/ JSON]. This has the advantage that the syntax allows backward-compatible extensions to the tests and the disadvantage that it is relatively verbose.&lt;br /&gt;
&lt;br /&gt;
==Basic Structure==&lt;br /&gt;
&lt;br /&gt;
 {&amp;quot;tests&amp;quot;: [&lt;br /&gt;
 &lt;br /&gt;
 {&amp;quot;description&amp;quot;:&amp;quot;Test description&amp;quot;,&lt;br /&gt;
 &amp;quot;input&amp;quot;:&amp;quot;input_string&amp;quot;,&lt;br /&gt;
 &amp;quot;output&amp;quot;:[expected_output_tokens]},&lt;br /&gt;
 &amp;quot;contentModelFlags&amp;quot;:[content_model_flags],&lt;br /&gt;
 &amp;quot;lastStartTag&amp;quot;:last_start_tag,&lt;br /&gt;
 &amp;quot;ignoreErrorOrder&amp;quot;:ignore_error_order&lt;br /&gt;
 ]}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;input&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;output&amp;lt;/tt&amp;gt; are always present. The other values are optional.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;input_string&amp;lt;/tt&amp;gt; is a string literal containing the input string to pass to the tokenizer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt; is a list of tokens, ordered with the first produced by the tokenizer the first (leftmost) in the list. The list must mach the &#039;&#039;&#039;complete&#039;&#039;&#039; list of tokens that the tokenizer should produce. Valid tokens are:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;DOCTYPE&amp;quot;, name, public_id, system_id, correctness]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}&#039;&#039;, true&#039;&#039;]&lt;br /&gt;
 [&amp;quot;StartTag&amp;quot;, name, {attributes}]&lt;br /&gt;
 [&amp;quot;EndTag&amp;quot;, name]&lt;br /&gt;
 [&amp;quot;Comment&amp;quot;, data]&lt;br /&gt;
 [&amp;quot;Character&amp;quot;, data]&lt;br /&gt;
 &amp;quot;ParseError&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;public_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_id&amp;lt;/tt&amp;gt; are either strings or &amp;lt;tt&amp;gt;null&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;correctness&amp;lt;/tt&amp;gt; is either &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;; &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; corresponds to the force-quirks flag being false, and vice-versa.&lt;br /&gt;
&lt;br /&gt;
When the self-closing flag is set, the &amp;lt;tt&amp;gt;StartTag&amp;lt;/tt&amp;gt; array has &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt; as its fourth entry. When the flag is not set, the array has only three entries for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is a list of strings from the set:&lt;br /&gt;
 PCDATA&lt;br /&gt;
 RCDATA&lt;br /&gt;
 RAWTEXT&lt;br /&gt;
 PLAINTEXT&lt;br /&gt;
The test case applies when the tokenizer begins with its content model flag set to any of those values. If &amp;lt;tt&amp;gt;content_model_flags&amp;lt;/tt&amp;gt; is omitted, it defaults to &amp;lt;tt&amp;gt;[&amp;quot;PCDATA&amp;quot;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;last_start_tag&amp;lt;/tt&amp;gt; is a lowercase string that should be used as &amp;quot;the tag name of the last start tag token emitted&amp;quot; in the tokenizer algorithm. If it is omitted, it is treated as if &amp;quot;no start tag token has ever been emitted by this instance of the tokeniser&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;ignore_error_order&amp;lt;/tt&amp;gt; is a boolean value indicating that the order of &amp;lt;tt&amp;gt;ParseError&amp;lt;/tt&amp;gt; tokens relative to other tokens in the output stream is unimportant, and implementations should ignore such differences between their output and &amp;lt;tt&amp;gt;expected_output_tokens&amp;lt;/tt&amp;gt;. (This is used for errors emitted by the input stream preprocessing stage, since it is useful to test that code but it is undefined when the errors occur). If it is omitted, it defaults to &amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multiple tests per file are allowed simply by adding more objects to the &amp;quot;tests&amp;quot; list.&lt;br /&gt;
&lt;br /&gt;
All adjacent character tokens are coalesced into a single &amp;lt;tt&amp;gt;[&amp;quot;Character&amp;quot;, data]&amp;lt;/tt&amp;gt; token.&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* Is the format too verbose?&lt;br /&gt;
* Do we want to allow the test to pass if only a subset of the actual tokens emitted matches the expected_output_tokens list?&lt;br /&gt;
&lt;br /&gt;
=Tree Construction Tests=&lt;br /&gt;
&lt;br /&gt;
Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&lt;br /&gt;
LF&lt;br /&gt;
[TEST]LF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where [TEST] is the following format:&lt;br /&gt;
&lt;br /&gt;
Each test must begin with a string &amp;quot;#data&amp;quot; followed by a newline (LF). All subsequent lines until a line that says &amp;quot;#errors&amp;quot; are the test data and must be passed to the system being tested unchanged, except with the final newline (on the last line) removed.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#errors&amp;quot;. It must be followed by one line per parse error that a conformant checker would return. It doesn&#039;t matter what those lines are, although they can&#039;t be &amp;quot;#document-fragment&amp;quot;, &amp;quot;#document&amp;quot;, or empty, the only thing that matters is that there be the right number of parse errors.&lt;br /&gt;
&lt;br /&gt;
Then there *may* be a line that says &amp;quot;#document-fragment&amp;quot;, which must be followed by a newline (LF), followed by a string of characters that indicates the context element, followed by a newline (LF). If this line is present the &amp;quot;#data&amp;quot; must be parsed using the HTML fragment parsing algorithm with the context element as context.&lt;br /&gt;
&lt;br /&gt;
Then there must be a line that says &amp;quot;#document&amp;quot;, which must be followed by a dump of the tree of the parsed DOM. Each node must be represented by a single line. Each line must start with &amp;quot;| &amp;quot;, followed by two spaces per parent node that the node has before the root document node.&lt;br /&gt;
* Element nodes must be represented by a &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then the &#039;&#039;tag name string&#039;&#039; &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;, and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their &#039;&#039;attribute name string&#039;&#039;, on subsequent lines, as if they were children of the element node.&lt;br /&gt;
* Attribute nodes must have the &#039;&#039;attribute name string&#039;&#039;, then an &amp;quot;=&amp;quot; sign, then the attribute value in double quotes (&amp;quot;).&lt;br /&gt;
* Text nodes must be the string, in double quotes. Newlines aren&#039;t escaped.&lt;br /&gt;
* Comments must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; then &amp;quot;&amp;lt;tt&amp;gt;!-- &amp;lt;/tt&amp;gt;&amp;quot; then the data then &amp;quot;&amp;lt;tt&amp;gt; --&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* DOCTYPEs must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE &amp;lt;/tt&amp;gt;&amp;quot; then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
* Processing instructions must be &amp;quot;&amp;lt;tt&amp;gt;&amp;lt;?&amp;lt;/tt&amp;gt;&amp;quot;, then the target, then a space, then the data and then &amp;quot;&amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;&amp;quot;. (The HTML parser cannot emit processing instructions, but scripts can, and the WebVTT to DOM rules can emit them.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;tag name string&#039;&#039; is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the SVG namespace, the namespace designator is &amp;quot;svg &amp;quot;. For the MathML namespace, the namespace designator is &amp;quot;math &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;attribute name string&#039;&#039; is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there&#039;s no prefix. For the XLink namespace, the namespace designator is &amp;quot;xlink &amp;quot;. For the XML namespace, the namespace designator is &amp;quot;xml &amp;quot;. For the XMLNS namespace, the namespace designator is &amp;quot;xmlns &amp;quot;. Note the difference between &amp;quot;xlink:href&amp;quot; which is an attribute in no namespace with the local name &amp;quot;xlink:href&amp;quot; and &amp;quot;xlink href&amp;quot; which is an attribute in the xlink namespace with the local name &amp;quot;href&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If there is also a &amp;quot;#document-fragment&amp;quot; the bit following &amp;quot;#document&amp;quot; must be a representation of the HTML fragment serialization for the context element given by &amp;quot;#document-fragment&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#data&lt;br /&gt;
&amp;lt;p&amp;gt;One&amp;lt;p&amp;gt;Two&lt;br /&gt;
#errors&lt;br /&gt;
3: Missing document type declaration&lt;br /&gt;
#document&lt;br /&gt;
| &amp;lt;html&amp;gt;&lt;br /&gt;
|   &amp;lt;head&amp;gt;&lt;br /&gt;
|   &amp;lt;body&amp;gt;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;One&amp;quot;&lt;br /&gt;
|     &amp;lt;p&amp;gt;&lt;br /&gt;
|       &amp;quot;Two&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tests can be found here: http://code.google.com/p/html5lib/source/browse/#hg%2Ftestdata%2Ftree-construction&lt;br /&gt;
&lt;br /&gt;
== Open Issues ==&lt;br /&gt;
* should relax the order constraint?&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=HTML5Lib&amp;diff=9276</id>
		<title>HTML5Lib</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=HTML5Lib&amp;diff=9276"/>
		<updated>2013-08-28T22:01:37Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: /* Testcases */ point to github repository&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib HTML5Lib] is a project to create both a Python-based and Ruby-based implementations of various parts of the WHATWG spec, in particular, a tokenizer, a parser, and a serializer. It is &#039;&#039;&#039;not&#039;&#039;&#039; an offical WHATWG project, however we plan to use this wiki to document and discuss the library design. The code is avaliable under an open-source MIT license.&lt;br /&gt;
&lt;br /&gt;
From December 2006 to March 2013, development took place on [http://code.google.com/p/html5lib/ code.google.com].&lt;br /&gt;
Since April 2013, it has been at [https://github.com/html5lib github].&lt;br /&gt;
&lt;br /&gt;
== SVN ==&lt;br /&gt;
Please commit often with sort of detailed descriptions of what you did. If you want to make sure you&#039;re not going to redo ask on the [http://groups.google.com/group/html5lib-discuss mailing list].  For questions that could benefit from quick turnaround, talk to people on #whatwg.&lt;br /&gt;
&lt;br /&gt;
== General ==&lt;br /&gt;
&lt;br /&gt;
In comments &amp;quot;XXX&amp;quot; indicates something that has yet to be done. Something might be wrong, has not yet been written and other things in that general direction.&lt;br /&gt;
&lt;br /&gt;
In comments &amp;quot;AT&amp;quot; indicates that the comment documents an alternate implementation technique or strategy.&lt;br /&gt;
&lt;br /&gt;
== HTMLTokenizer ==&lt;br /&gt;
&lt;br /&gt;
The tokenizer is controlled by a single HTMLTokenizer class stored in tokenizer.py at the moment. You initialize the HTMLTokenizer with a stream argument that holds an HTMLInputStream. You can iterate over the object created to get tokens back.&lt;br /&gt;
&lt;br /&gt;
Currently tokens are objects, they will become dicts.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The parser needs to change the self.contentModelFlag attribute which affects how certain states are handled.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
* Use of if statements in the states may be suboptimal (but we should time this)&lt;br /&gt;
&lt;br /&gt;
== HTMLParser ==&lt;br /&gt;
&lt;br /&gt;
=== Profiling on web-apps.htm ===&lt;br /&gt;
&lt;br /&gt;
I did some profiling on web-apps.htm which is a rather large document. Based on that I already changed a number of things which speed us up a bit. Below are some things to consider for future revisions:&lt;br /&gt;
&lt;br /&gt;
* utils.MethodDispatcher is invoked way too often. By pre declaring some of it in InBody I managed to decrease the amount of invocatoins by over 24.000, but InBody.__init__ is invoked about 7000 times for web-apps.htm so that amount could be higher. Not sure how to put them somewhere else though. First thing I tried was HTMLParser but references get all messed up then...&lt;br /&gt;
: We should be able to store a single instance of each InsertionMode rather than creating a new one every time the mode switches. Hopefully we have been disiplined enough not to keep any state in those classes so the change should be painless.&lt;br /&gt;
:: That&#039;s an interesting idea. How would that work? [[User:Annevk|Annevk]] 12:49, 25 December 2006 (UTC)&lt;br /&gt;
::: I got an idea on how it might work and it worked! Still about 3863 invocations to utils.MethodDispatcher but it takes 0.000 CPU seconds. I suppose we can decrease that amount even more, but I wonder if it&#039;s worth it. [[User:Annevk|Annevk]] 11:37, 26 December 2006 (UTC)&lt;br /&gt;
&lt;br /&gt;
* 713194 calls to __contains__ in sets.py makes us slow. Takes about 1.0x CPU seconds. &lt;br /&gt;
: I&#039;ve just switched to the built-in sets type. hopefully this will help a bit [[User:Jgraham|Jgraham]] 00:30, 25 December 2006 (UTC)&lt;br /&gt;
:: It did. (Not surprisingly when 700.000 method calls are gone...) [[User:Annevk|Annevk]] 12:49, 25 December 2006 (UTC)&lt;br /&gt;
&lt;br /&gt;
* 440382 calls to char in tokenizer.py is the runner up with 0.8x CPU seconds.&lt;br /&gt;
: This is now the largest time consumer. [[User:Annevk|Annevk]] 12:49, 25 December 2006 (UTC)&lt;br /&gt;
&lt;br /&gt;
* dataState in tokenizer.py with 0.7 CPU seconds is next.&lt;br /&gt;
: This is now at 0.429 CPU seconds. Probably becase the tokenizer switched to dicts instead of custom Token objects. [[User:Annevk|Annevk]]&lt;br /&gt;
&lt;br /&gt;
* __iter__ in tokenizer.py with 0.59x CPU seconds...&lt;br /&gt;
&lt;br /&gt;
* Creation of all node objects in web-apps takes .57x CPU seconds.&lt;br /&gt;
&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
== Testcases ==&lt;br /&gt;
Testcases are in the [https://github.com/html5lib/html5lib-tests html5lib-tests repository]. They require [http://cheeseshop.python.org/pypi/simplejson simplejson]. New code should not be checked in if it regresses previously functional unit tests. Similarly, new tests that don&#039;t pass should not be checked in without both informing others on the [http://groups.google.com/group/html5lib-discuss mailing list] and a concrete plan.  Ideally new features should be accompanied by new unit tests for those features. Documentation of the test format is available at [[Parser_tests]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Implementations]]&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=HTML5Lib&amp;diff=9275</id>
		<title>HTML5Lib</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=HTML5Lib&amp;diff=9275"/>
		<updated>2013-08-28T21:54:51Z</updated>

		<summary type="html">&lt;p&gt;Jmdyck: Update re project move to github.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/html5lib HTML5Lib] is a project to create both a Python-based and Ruby-based implementations of various parts of the WHATWG spec, in particular, a tokenizer, a parser, and a serializer. It is &#039;&#039;&#039;not&#039;&#039;&#039; an offical WHATWG project, however we plan to use this wiki to document and discuss the library design. The code is avaliable under an open-source MIT license.&lt;br /&gt;
&lt;br /&gt;
From December 2006 to March 2013, development took place on [http://code.google.com/p/html5lib/ code.google.com].&lt;br /&gt;
Since April 2013, it has been at [https://github.com/html5lib github].&lt;br /&gt;
&lt;br /&gt;
== SVN ==&lt;br /&gt;
Please commit often with sort of detailed descriptions of what you did. If you want to make sure you&#039;re not going to redo ask on the [http://groups.google.com/group/html5lib-discuss mailing list].  For questions that could benefit from quick turnaround, talk to people on #whatwg.&lt;br /&gt;
&lt;br /&gt;
== General ==&lt;br /&gt;
&lt;br /&gt;
In comments &amp;quot;XXX&amp;quot; indicates something that has yet to be done. Something might be wrong, has not yet been written and other things in that general direction.&lt;br /&gt;
&lt;br /&gt;
In comments &amp;quot;AT&amp;quot; indicates that the comment documents an alternate implementation technique or strategy.&lt;br /&gt;
&lt;br /&gt;
== HTMLTokenizer ==&lt;br /&gt;
&lt;br /&gt;
The tokenizer is controlled by a single HTMLTokenizer class stored in tokenizer.py at the moment. You initialize the HTMLTokenizer with a stream argument that holds an HTMLInputStream. You can iterate over the object created to get tokens back.&lt;br /&gt;
&lt;br /&gt;
Currently tokens are objects, they will become dicts.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The parser needs to change the self.contentModelFlag attribute which affects how certain states are handled.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
* Use of if statements in the states may be suboptimal (but we should time this)&lt;br /&gt;
&lt;br /&gt;
== HTMLParser ==&lt;br /&gt;
&lt;br /&gt;
=== Profiling on web-apps.htm ===&lt;br /&gt;
&lt;br /&gt;
I did some profiling on web-apps.htm which is a rather large document. Based on that I already changed a number of things which speed us up a bit. Below are some things to consider for future revisions:&lt;br /&gt;
&lt;br /&gt;
* utils.MethodDispatcher is invoked way too often. By pre declaring some of it in InBody I managed to decrease the amount of invocatoins by over 24.000, but InBody.__init__ is invoked about 7000 times for web-apps.htm so that amount could be higher. Not sure how to put them somewhere else though. First thing I tried was HTMLParser but references get all messed up then...&lt;br /&gt;
: We should be able to store a single instance of each InsertionMode rather than creating a new one every time the mode switches. Hopefully we have been disiplined enough not to keep any state in those classes so the change should be painless.&lt;br /&gt;
:: That&#039;s an interesting idea. How would that work? [[User:Annevk|Annevk]] 12:49, 25 December 2006 (UTC)&lt;br /&gt;
::: I got an idea on how it might work and it worked! Still about 3863 invocations to utils.MethodDispatcher but it takes 0.000 CPU seconds. I suppose we can decrease that amount even more, but I wonder if it&#039;s worth it. [[User:Annevk|Annevk]] 11:37, 26 December 2006 (UTC)&lt;br /&gt;
&lt;br /&gt;
* 713194 calls to __contains__ in sets.py makes us slow. Takes about 1.0x CPU seconds. &lt;br /&gt;
: I&#039;ve just switched to the built-in sets type. hopefully this will help a bit [[User:Jgraham|Jgraham]] 00:30, 25 December 2006 (UTC)&lt;br /&gt;
:: It did. (Not surprisingly when 700.000 method calls are gone...) [[User:Annevk|Annevk]] 12:49, 25 December 2006 (UTC)&lt;br /&gt;
&lt;br /&gt;
* 440382 calls to char in tokenizer.py is the runner up with 0.8x CPU seconds.&lt;br /&gt;
: This is now the largest time consumer. [[User:Annevk|Annevk]] 12:49, 25 December 2006 (UTC)&lt;br /&gt;
&lt;br /&gt;
* dataState in tokenizer.py with 0.7 CPU seconds is next.&lt;br /&gt;
: This is now at 0.429 CPU seconds. Probably becase the tokenizer switched to dicts instead of custom Token objects. [[User:Annevk|Annevk]]&lt;br /&gt;
&lt;br /&gt;
* __iter__ in tokenizer.py with 0.59x CPU seconds...&lt;br /&gt;
&lt;br /&gt;
* Creation of all node objects in web-apps takes .57x CPU seconds.&lt;br /&gt;
&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
== Testcases ==&lt;br /&gt;
Testcases are under the /tests directory. They require [http://cheeseshop.python.org/pypi/simplejson simplejson]. New code should not be checked in if it regresses previously functional unit tests. Similarly, new tests that don&#039;t pass should not be checked in without both informing others on the [http://groups.google.com/group/html5lib-discuss mailing list] and a concrete plan.  Ideally new features should be accompanied by new unit tests for those features. Documentation of the test format is available at [[Parser_tests]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Implementations]]&lt;/div&gt;</summary>
		<author><name>Jmdyck</name></author>
	</entry>
</feed>