Skip to content

Commit 92d1035

Browse files
committed
add html5lib tests
Squashed commit of the following: commit ce0f083 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed Jan 17 16:19:08 2024 +0100 Add skip for known bug - all tests passing or skipped commit dcdc710 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed Jan 17 16:15:05 2024 +0100 Rename class and test function commit 6a087d2 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed Jan 17 16:11:42 2024 +0100 Fixing more lints commit 60d1738 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 22:44:52 2024 +0100 Clean up and refactor test document parsing commit 2871f31 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 22:12:18 2024 +0100 Add attributes to html5lib tests commit 429c506 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 15:08:26 2024 +0100 Fix lint commit 36c94f7 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 14:37:06 2024 +0100 Skip head tests commit 994b9d0 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 14:31:22 2024 +0100 Fix some comments commit e1fbeb4 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 14:13:11 2024 +0100 Fix strlen paren bug commit 84a61b1 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 14:09:38 2024 +0100 Fix lints commit 315d5cd Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 14:09:31 2024 +0100 Mark unsupported markup tests as incomplete, not skipped commit 6035fd7 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 14:06:10 2024 +0100 Skip incomplete token tests commit 3772db6 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Jan 16 14:01:29 2024 +0100 Update ignores commit f1b23b6 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Jan 15 21:35:50 2024 +0100 Fix HTML input processing commit 1e01888 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Jan 15 19:05:22 2024 +0100 Use padded line number Allows filetering like line0001 so not line1 line10 line11… commit 48eb7b9 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Jan 15 18:31:27 2024 +0100 Use line numbers for test IDs Line numbers are stable even if we skip tests commit 91c6f73 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Fri Dec 22 17:38:19 2023 +0100 Avoid running tests that expect anything in <head> commit e570196 Author: Dennis Snell <dennis.snell@automattic.com> Date: Wed Dec 20 10:49:50 2023 -0600 Add extra skipped tests commit d642bfb Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed Dec 20 13:22:07 2023 +0100 Fix expect/actual ordering, add test message commit 12dcc69 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 20:20:26 2023 +0100 Move test data to test data dir commit 138d21f Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 18:32:55 2023 +0100 Add ignores for formatting elements commit 47d2f36 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 18:25:56 2023 +0100 Fix lint commit 4c6a28b Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 18:16:09 2023 +0100 Add files crediting html5lib-tests project commit f5afccb Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 18:06:37 2023 +0100 Add skipping of certain tests commit 123ae09 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 15:30:03 2023 +0100 Remove space from test identifier, easier copy/paste filtering commit d995e44 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 15:20:47 2023 +0100 Better tag finding commit db5e68f Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 14:07:30 2023 +0100 Print nicer tests names commit 257b871 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 13:59:21 2023 +0100 Skip doctype and comments in test dom tree commit b31c921 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Tue Dec 19 13:58:57 2023 +0100 1-index test case numbering commit 10dc753 Author: Dennis Snell <dennis.snell@automattic.com> Date: Mon Dec 18 16:20:41 2023 -0600 WPCS Nags commit 087e7bb Author: Dennis Snell <dennis.snell@automattic.com> Date: Mon Dec 18 15:57:53 2023 -0600 Add line number to test case label commit 4f5ca93 Author: Dennis Snell <dennis.snell@automattic.com> Date: Mon Dec 18 15:23:47 2023 -0600 Avoid WPCS lint nags; skip tests for unsupported input or fragment context. commit 9faf91b Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Dec 18 21:38:12 2023 +0100 Skip unhandled tests commit 077e082 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Dec 18 21:22:51 2023 +0100 fix lints commit bf618ac Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Dec 18 21:18:04 2023 +0100 Move html5lib tests to new class commit 1f89fbd Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Dec 18 21:13:49 2023 +0100 Remove git files from html5lib commit ed2f784 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Mon Dec 18 20:26:12 2023 +0100 Add test cases from html5lib-tests tree-construction
1 parent 26c781e commit 92d1035

61 files changed

Lines changed: 24562 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Credits
2+
=======
3+
4+
The ``html5lib`` test data is maintained by:
5+
6+
- James Graham
7+
- Geoffrey Sneddon
8+
9+
10+
Contributors
11+
------------
12+
13+
- Adam Barth
14+
- Andi Sidwell
15+
- Anne van Kesteren
16+
- David Flanagan
17+
- Edward Z. Yang
18+
- Geoffrey Sneddon
19+
- Henri Sivonen
20+
- Ian Hickson
21+
- Jacques Distler
22+
- James Graham
23+
- Lachlan Hunt
24+
- lantis63
25+
- Mark Pilgrim
26+
- Mats Palmgren
27+
- Ms2ger
28+
- Nolan Waite
29+
- Philip Taylor
30+
- Rafael Weinstein
31+
- Ryan King
32+
- Sam Ruby
33+
- Simon Pieters
34+
- Thomas Broyer
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) 2006-2013 James Graham, Geoffrey Sneddon, and
2+
other contributors
3+
4+
Permission is hereby granted, free of charge, to any person obtaining
5+
a copy of this software and associated documentation files (the
6+
"Software"), to deal in the Software without restriction, including
7+
without limitation the rights to use, copy, modify, merge, publish,
8+
distribute, sublicense, and/or sell copies of the Software, and to
9+
permit persons to whom the Software is furnished to do so, subject to
10+
the following conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
html5lib-tests
2+
==============
3+
4+
This test data was taken from:
5+
6+
https://github.com/html5lib/html5lib-tests
7+
8+
The sha was `a9f44960a9fedf265093d22b2aa3c7ca123727b9`.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Tree Construction Tests
2+
=======================
3+
4+
Each file containing tree construction tests consists of any number of
5+
tests separated by two newlines (LF) and a single newline before the end
6+
of the file. For instance:
7+
8+
[TEST]LF
9+
LF
10+
[TEST]LF
11+
LF
12+
[TEST]LF
13+
14+
Where [TEST] is the following format:
15+
16+
Each test must begin with a string "\#data" followed by a newline (LF).
17+
All subsequent lines until a line that says "\#errors" are the test data
18+
and must be passed to the system being tested unchanged, except with the
19+
final newline (on the last line) removed.
20+
21+
Then there must be a line that says "\#errors". It must be followed by
22+
one line per parse error that a conformant checker would return. It
23+
doesn't matter what those lines are, although they can't be
24+
"\#new-errors", "\#document-fragment", "\#document", "\#script-off",
25+
"\#script-on", or empty, the only thing that matters is that there be
26+
the right number of parse errors.
27+
28+
Then there \*may\* be a line that says "\#new-errors", which works like
29+
the "\#errors" section adding more errors to the expected number of
30+
errors.
31+
32+
Then there \*may\* be a line that says "\#document-fragment", which must
33+
be followed by a newline (LF), followed by a string of characters that
34+
indicates the context element, followed by a newline (LF). If the string
35+
of characters starts with "svg ", the context element is in the SVG
36+
namespace and the substring after "svg " is the local name. If the
37+
string of characters starts with "math ", the context element is in the
38+
MathML namespace and the substring after "math " is the local name.
39+
Otherwise, the context element is in the HTML namespace and the string
40+
is the local name. If this line is present the "\#data" must be parsed
41+
using the HTML fragment parsing algorithm with the context element as
42+
context.
43+
44+
Then there \*may\* be a line that says "\#script-off" or
45+
"\#script-on". If a line that says "\#script-off" is present, the
46+
parser must set the scripting flag to disabled. If a line that says
47+
"\#script-on" is present, it must set it to enabled. Otherwise, the
48+
test should be run in both modes.
49+
50+
Then there must be a line that says "\#document", which must be followed
51+
by a dump of the tree of the parsed DOM. Each node must be represented
52+
by a single line. Each line must start with "| ", followed by two spaces
53+
per parent node that the node has before the root document node.
54+
55+
- Element nodes must be represented by a "`<`" then the *tag name
56+
string* "`>`", and all the attributes must be given, sorted
57+
lexicographically by UTF-16 code unit according to their *attribute
58+
name string*, on subsequent lines, as if they were children of the
59+
element node.
60+
- Attribute nodes must have the *attribute name string*, then an "="
61+
sign, then the attribute value in double quotes (").
62+
- Text nodes must be the string, in double quotes. Newlines aren't
63+
escaped.
64+
- Comments must be "`<`" then "`!-- `" then the data then "` -->`".
65+
- DOCTYPEs must be "`<!DOCTYPE `" then the name then if either of the
66+
system id or public id is non-empty a space, public id in
67+
double-quotes, another space an the system id in double-quotes, and
68+
then in any case "`>`".
69+
- Processing instructions must be "`<?`", then the target, then a
70+
space, then the data and then "`>`". (The HTML parser cannot emit
71+
processing instructions, but scripts can, and the WebVTT to DOM
72+
rules can emit them.)
73+
- Template contents are represented by the string "content" with the
74+
children below it.
75+
76+
The *tag name string* is the local name prefixed by a namespace
77+
designator. For the HTML namespace, the namespace designator is the
78+
empty string, i.e. there's no prefix. For the SVG namespace, the
79+
namespace designator is "svg ". For the MathML namespace, the namespace
80+
designator is "math ".
81+
82+
The *attribute name string* is the local name prefixed by a namespace
83+
designator. For no namespace, the namespace designator is the empty
84+
string, i.e. there's no prefix. For the XLink namespace, the namespace
85+
designator is "xlink ". For the XML namespace, the namespace designator
86+
is "xml ". For the XMLNS namespace, the namespace designator is "xmlns
87+
". Note the difference between "xlink:href" which is an attribute in no
88+
namespace with the local name "xlink:href" and "xlink href" which is an
89+
attribute in the xlink namespace with the local name "href".
90+
91+
If there is also a "\#document-fragment" the bit following "\#document"
92+
must be a representation of the HTML fragment serialization for the
93+
context element given by "\#document-fragment".
94+
95+
For example:
96+
97+
#data
98+
<p>One<p>Two
99+
#errors
100+
3: Missing document type declaration
101+
#document
102+
| <html>
103+
| <head>
104+
| <body>
105+
| <p>
106+
| "One"
107+
| <p>
108+
| "Two"

0 commit comments

Comments
 (0)