-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML API: Add test suite from html5lib #5794
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
36341a1
to
d7f9e97
Compare
Rebased. I started skipping tests that don't expect empty head. |
This comment was marked as resolved.
This comment was marked as resolved.
5b434ef
to
968a381
Compare
I'm confident at this point that this license is compatible. The GNU page on compatible license mentions it (although they call it Expat). Additionally, jQuery and React are both MIT licensed, and WordPress uses them. |
43af3a4
to
c23cda9
Compare
This is ready for review. |
1101b3d
to
60d1738
Compare
I've renamed the class and test method to |
I've also skipped the remaining failing test, I clearly marked it as a bug in its skip message. |
766a1e3
to
a94d154
Compare
a94d154
to
b501e75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure when I left this comment, but I apparently forgot to hit submit review and thus it never posted
b501e75
to
c0e547f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
4c035f9
to
9aef2e5
Compare
@dmsnell and I looked at a test case where we fail to reach a text node at the end of the document in these tests. The text node seems to be reached, but its token type is |
Co-authored-by: Colin Stewart <[email protected]>
0fd0a04
to
209af9a
Compare
A couple of the test data files are being detected as binary by Git. The html5lib repo uses this .gitattributes file to correct it. To ensure the files are always human-readable whether locally or in PRs, can we add the following file to this PR?
|
Thanks @costdev - good catch! |
Add a suite of tests for the HTML API taken from https://github.com/html5lib/html5lib-tests/tree/a9f44960a9fedf265093d22b2aa3c7ca123727b9
That repository is MIT licensed.
Only the tree construction tests are taken. This suite of tests is also used by the servo project to test its html5ever package.
In this PR we extract relevant test data from
html5lib-tests
and use it to test the HTML Processor. We transform the HTML Processor output to match the expected tree shape fromhtml5lib-tests
. We also explicitly skip some tests based on their test data names. Test data names look liketests20/line0497
where the form is:where
test_line_number
is padded to 4 digits.Tests can be skipped by adding them to the SKIP_TEST array. Tests are easy to filter by running e.g.
phpunit --filter=tests1/line0001
.TODO
tests/phpunit/data
Trac ticket: https://core.trac.wordpress.org/ticket/60227
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.