test: add integration tests for sentence-length rule#31
test: add integration tests for sentence-length rule#313w36zj6 merged 17 commits intotextlint:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive integration tests for the textlint-rule-sentence-length rule to verify that the Typst plugin correctly handles various document structures. The tests ensure that sentence length validation is properly applied to regular text while ignoring comments, math blocks, and other non-text elements.
Key changes:
- Added 10 integration test cases covering comments, lists, math blocks, figures, and nested content
- Created fixture files demonstrating valid and invalid scenarios for sentence length validation
- Added
textlint-rule-sentence-length(v5.2.1) as a dev dependency
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/integration/linting.test.ts | Added new test suite with helper functions and 10 test cases for sentence-length rule validation |
| test/integration/fixtures/smoke/textlint-rule-sentence-length/*.typ | Created fixture files for testing various scenarios (comments, lists, math, figures, nested content) |
| package.json | Added textlint-rule-sentence-length v5.2.1 as a dev dependency |
| bun.lock | Updated lock file with new dependency and its transitive dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
df3d760 to
29a6ed7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
TODO:
Notes
The following test cases are failing because of an implementation bug:
should handle elements immediately below comments
should handle nested lists
Current Behavior: When non-sentence elements (e.g., functions) are included as list items, they are automatically wrapped in a Paragraph. This causes them to be incorrectly targeted by sentence-length validation, leading to failures.
Expected Behavior: These elements should not be wrapped in a Paragraph. Their behavior should align with top-level elements (not in a list), which are not wrapped and thus exempt from sentence-length checks.
Example:
Input:
Actual AST:
Expected AST:
should detect violations in term lists