Repository navigation
Add regression tests for the child combinator matching the root - #112
Merged
Merged
Conversation
…e root X > * also matches the root element, whose parent is the document. The guard in combineDirectDescendant() added in #50 fixed the TypeError this caused, but no test failed when it was removed. Cover the descendant, adjacent and general sibling combinators the same way. Refs #74 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
============================================
+ Coverage 90.69% 90.75% +0.06%
Complexity 1424 1424
============================================
Files 25 25
Lines 3170 3170
============================================
+ Hits 2875 2877 +2
+ Misses 295 293 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds regression coverage for #74, which was fixed in #50.
When the right-hand side of
X > *matched the root element,combineDirectDescendant()passed the document tomatchesSimpleSelector(), which threw aTypeError:#50 added a guard for this, but the suite still passed with the guard removed.
tests/Issues/Issue74Test.phpasserts the matched tag names for:wrap > *,root > *and* > *throughqp(), both as the constructor selector and throughfind()ul > *throughhtmlqp()andhtml5qp()* *,* + *and* ~ *, whose right-hand sides also match the rootWith the guard removed, the child combinator tests fail with the
TypeErrorfrom the issue. The descendant and sibling cases protect the non-element skips in those combinators' own loops. This is a test-only change with no behaviour change, so there's no CHANGELOG entry.Refs #74.
🤖 Generated with Claude Code