Make WordPress Core

Opened 4 months ago

Closed 4 months ago

Last modified 4 months ago

#61102 closed defect (bug) (fixed)

Tests: Html5lib-tests context tag needs to be reset

Reported by: jonsurrell's profile jonsurrell Owned by: jonsurrell's profile jonsurrell
Milestone: 6.6 Priority: normal
Severity: normal Version: 6.6
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

The html5lib-tests suite parses tests from a number of files with a specific data format. It uses a dataProvider in a loop that yields test information. This relies on some variables being reset on each iteration. The context element is not properly reset on each iteration.

The test specification describes the context element as follows:

Then there *may* be a line that says "#document-fragment", 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 the string of characters starts with "svg ", the context element is in the SVG namespace and the substring after "svg " is the local name. If the string of characters starts with "math ", the context element is in the MathML namespace and the substring after "math " is the local name. Otherwise, the context element is in the HTML namespace and the string is the local name. If this line is present the "#data" must be parsed using the HTML fragment parsing algorithm with the context element as context.

Without the proper reset of this value, a single context element would change subsequent tests, breaking the test suite.

Change History (7)

#1 @jonsurrell
4 months ago

On trunk, when running this suite we see:

OK, but incomplete, skipped, or risky tests!
Tests: 505, Assertions: 70, Skipped: 435.

When fixing the issue we see:

Tests: 505, Assertions: 72, Failures: 1, Skipped: 433.

There's a new failure that was in a skipped test. Tests that have context elements are skipped because HTML API only supports body at the moment.

This ticket was mentioned in PR #6464 on WordPress/wordpress-develop by @jonsurrell.


4 months ago
#2

  • Keywords has-patch has-unit-tests added

#3 @jonsurrell
4 months ago

@dmsnell This is a small bugfix that was causing 2 tests to be incorrectly skipped in the html5lib-tests for HTML API.

@dmsnell commented on PR #6464:


4 months ago
#4

ah. there's more of a description in the Trac ticket. feel free to duplicate descriptions 😉

#5 @dmsnell
4 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 58072:

HTML API: Fix context reset in html5lib test suite.

The html5lib-tests suite parses tests from a number of files with a specific
data format. It uses a dataProvider in a loop that yields test information.
This relies on some variables being reset on each iteration. The context
element has not properly reset on each iteration.

The test specification describes the context element as follows:
https://github.com/html5lib/html5lib-tests/blob/a9f44960a9fedf265093d22b2aa3c7ca123727b9/tree-construction/README.md

Then there *may* be a line that says "#document-fragment", 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 the string of characters
starts with "svg ", the context element is in the SVG namespace and the
substring after "svg " is the local name. If the string of characters starts
with "math ", the context element is in the MathML namespace and the
substring after "math " is the local name. Otherwise, the context element is
in the HTML namespace and the string is the local name. If this line is
present the "#data" must be parsed using the HTML fragment parsing algorithm
with the context element as context.

Without the proper reset of this value, a single context element would change
subsequent tests, breaking the test suite.

This patch adds the reset to ensure that the test suite works properly.

Developed in https://github.com/WordPress/wordpress-develop/pull/6464
Discussed in https://core.trac.wordpress.org/ticket/61102

Fixes #61102.
Props costdev, dmsnell, jonsurrell.

#7 @dmsnell
4 months ago

  • Milestone changed from Awaiting Review to 6.6
Note: See TracTickets for help on using tickets.