Skip to content

Restructure integration tests by feature#97

Merged
leynos merged 11 commits intomainfrom
codex/refactor-integration-tests-by-feature
Jul 19, 2025
Merged

Restructure integration tests by feature#97
leynos merged 11 commits intomainfrom
codex/refactor-integration-tests-by-feature

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jul 18, 2025

Summary

  • split integration tests into separate modules
  • add missing imports and fixture helpers
  • keep shared helpers in tests/common
  • remove giant integration.rs file

Testing

  • make fmt
  • make lint
  • make test

https://chatgpt.com/codex/tasks/task_e_687ac418add8832286a229a4798d67b9

Summary by Sourcery

Organize and expand integration tests by grouping them into dedicated feature modules, centralizing shared helpers, and adding parameterized rstest fixtures to improve coverage across list renumbering, table formatting, text wrapping, CLI behavior, and thematic breaks.

New Features:

  • Restructure integration tests into feature-specific modules (lists, table, wrap, cli, breaks).
  • Introduce parameterized rstest fixtures for renumbering, table reflow, HTML conversion, text wrapping, CLI options, and thematic breaks.

Enhancements:

  • Centralize shared test macros and helpers in tests/common and re-export via a prelude module.
  • Refine clippy annotation in the FormatOpts struct to use the expect attribute.

Documentation:

  • Standardize ellipsis notation in rstest fixture documentation.

Tests:

  • Expand coverage with edge-case tests for nested lists, code fences, blockquotes, footnotes, uniform table formatting, hard line breaks, and CLI flags.

Chores:

  • Remove the monolithic integration.rs file and distribute tests across modular files.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jul 18, 2025

Reviewer's Guide

This PR restructures the integration test suite by splitting the monolithic tests into feature-focused modules, centralizes common test macros and fixtures under tests/common with a shared prelude, updates documentation to use unicode ellipsis in rstest macros, and removes the old integration.rs file with a small clippy annotation tweak in main.rs.

Class diagram for the new integration test module structure

classDiagram
    class common {
        <<module>>
        +shared helpers
        +test macros
    }
    class prelude {
        <<module>>
        +re-exports from common
    }
    class lists {
        <<test module>>
        +list renumbering tests
    }
    class table {
        <<test module>>
        +table reflow and HTML conversion tests
    }
    class wrap {
        <<test module>>
        +wrapping behavior tests
    }
    class cli {
        <<test module>>
        +CLI options tests
    }
    class breaks {
        <<test module>>
        +thematic break formatting tests
    }
    common <|-- prelude
    prelude <.. lists : uses
    prelude <.. table : uses
    prelude <.. wrap : uses
    prelude <.. cli : uses
    prelude <.. breaks : uses
Loading

File-Level Changes

Change Details Files
Restructure integration tests into feature-based modules
  • Created separate test files for lists, tables, wrapping, CLI behavior, and thematic breaks
  • Added tests/prelude/mod.rs to expose assert_cmd::Command and common helpers
  • Deleted the legacy tests/integration.rs file
tests/lists.rs
tests/table.rs
tests/wrap.rs
tests/cli.rs
tests/breaks.rs
tests/prelude/mod.rs
tests/integration.rs
Centralize shared test helpers
  • Moved lines_vec and include_lines macros into tests/common/mod.rs
  • Extracted helper functions (assert_wrapped_list_item, assert_wrapped_blockquote) into common
  • Updated test modules to import prelude and use shared macros instead of local definitions
tests/common/mod.rs
tests/lists.rs
tests/prelude/mod.rs
Update rstest documentation to use unicode ellipsis
  • Replaced ASCII '...' in macro signatures with unicode '…' in docs
  • Adjusted markdown formatting in rstest fixture reference section
docs/rust-testing-with-rstest-fixtures.md
Refine clippy attribute in CLI struct
  • Replaced #[allow(clippy::struct_excessive_bools)] with #[expect(clippy::struct_excessive_bools, ...)] on FormatOpts
src/main.rs

Possibly linked issues

  • Add tests for HTML table conversion #24: PR introduces lines_vec! and include_lines! macros, centralizing them in tests/common and using them in new test files, directly addressing the issue's goal of reducing test fixture duplication with a helper function/macro.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 18, 2025

Summary by CodeRabbit

  • Documentation

    • Improved formatting and wording in the Rust rstest crate documentation for better readability.
  • Tests

    • Added new integration tests covering table formatting, CLI options, list renumbering, thematic breaks, ellipsis replacement, and text wrapping.
    • Enhanced test coverage for Markdown table reflow, HTML table conversion, and complex wrapping scenarios.
    • Refactored test utilities and introduced a shared prelude for common test imports.
    • Removed the legacy integration test suite, replacing it with more modular and comprehensive test modules.

Walkthrough

Refactor the integration test suite by splitting it into focused modules for tables, lists, wrapping, breaks, and CLI behaviour. Remove the monolithic integration.rs file and introduce new parameterised and CLI tests. Update documentation formatting in the rstest guide and adjust lint attributes in the main source. Centralise test utilities in a prelude module.

Changes

File(s) Change Summary
tests/integration.rs Entire integration test suite removed; all fixtures and tests deleted.
tests/table.rs, tests/lists.rs, tests/wrap.rs, tests/breaks.rs, tests/cli.rs New test modules added for table handling, list renumbering, wrapping, thematic breaks, and CLI integration. Each contains focused, parameterised, or CLI-driven tests.
tests/prelude/mod.rs New prelude module introduced to centralise imports and expose shared test utilities.
tests/common/mod.rs Add macro export and allow attributes; expand documentation for test utility macros and functions.
docs/rust-testing-with-rstest-fixtures.md Update attribute formatting to use Unicode ellipsis; minor rephrasing for clarity.
src/main.rs Change lint attribute from allow to expect with explicit reason on FormatOpts struct.

Sequence Diagram(s)

sequenceDiagram
    participant Tester as Test Module (e.g. table.rs, lists.rs)
    participant CLI as mdtablefix CLI
    participant Core as Core Functions (e.g. reflow_table, renumber_lists)
    participant Utils as Shared Test Utilities

    Tester->>Utils: Import macros/functions via prelude
    Tester->>CLI: Invoke CLI with options (e.g. --wrap, --renumber)
    CLI->>Core: Call core processing functions
    Core-->>CLI: Return processed output
    CLI-->>Tester: Output for assertions
Loading

Possibly related PRs

  • Convert rstest docs to third person lille#66: The main PR and the retrieved PR both modify the same documentation file docs/rust-testing-with-rstest-fixtures.md focusing on editorial improvements, including phrasing and formatting changes, without altering code or functionality.
  • Implement push queue DLQ wireframe#198: The main PR updates formatting and wording in the rstest crate documentation without changing any code, while the retrieved PR also includes purely editorial and formatting improvements in the same rust-testing-with-rstest-fixtures.md documentation file, making their changes related at the documentation formatting level.
  • Fix markdown fenced code block languages #52: Related documentation formatting updates in docs/rust-testing-with-rstest-fixtures.md.

Poem

Splitting tests with nimble hand,
Each feature finds its rightful land.
Tables, lists, and wraps anew,
CLI and breaks join the crew.
Docs now shine with ellipsis bright—
Unicode dots, a pleasing sight!

🦀✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a52a67 and 7fb1072.

📒 Files selected for processing (1)
  • tests/wrap.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md

⚙️ CodeRabbit Configuration File

🧬 Code Graph Analysis (1)
tests/wrap.rs (2)
src/process.rs (1)
  • process_stream (81-81)
tests/common/mod.rs (2)
  • assert_wrapped_list_item (41-77)
  • assert_wrapped_blockquote (86-91)
🔇 Additional comments (26)
tests/wrap.rs (26)

1-12: Module documentation is comprehensive and well-structured.

The module documentation clearly explains the purpose and utility of the wrapping tests, covering all major functionality areas as required by the coding guidelines.


13-17: Imports and module structure are correct.

The imports are properly organised with the required process_stream function and prelude module structure following established patterns.


18-31: Paragraph wrapping test is well-documented and implemented.

The test correctly verifies that long paragraphs are wrapped at 80-character boundaries with proper assertions for line count and length limits.


33-42: Long word handling test correctly addresses edge case.

This test properly verifies that single words exceeding 80 characters remain unbroken, which is the expected behaviour for wrapping algorithms.


44-55: List item wrapping test demonstrates proper prefix preservation.

The test correctly uses the assert_wrapped_list_item helper to verify both wrapping and prefix formatting maintenance.


57-74: Parameterised test effectively covers multiple list prefix formats.

The rstest parameterisation efficiently tests various bullet and numbered list prefixes whilst maintaining inline code span integrity. The documentation clearly explains the test's purpose.


76-89: Inline code span preservation test is well-implemented.

The test correctly verifies that backtick-delimited code spans remain intact during wrapping operations.


91-103: Multi-backtick code span test addresses important edge case.

This test ensures that code spans using multiple backticks (cmd, echo) are properly preserved during wrapping.


105-117: Multiple inline code spans test is comprehensive.

The test correctly verifies that multiple code spans within a single line are all preserved when wrapping occurs.


118-138: Long inline code item test includes specific assertion.

The test correctly verifies that long code spans are wrapped appropriately and includes a specific assertion that the first line ends with the expected code delimiter.


140-161: Future attribute punctuation test addresses complex edge case.

This test correctly handles the wrapping of Rust attribute syntax within inline code spans. The expected output verification ensures precise formatting behaviour.


163-175: Footnote multiline test correctly uses helper function.

The test properly verifies footnote wrapping with correct indentation using the assert_wrapped_list_item helper.


177-188: Footnote with inline code test covers important combination.

This test ensures that code spans within footnotes are preserved during wrapping operations.


190-206: Angle bracket URL test addresses specific formatting requirement.

The test correctly verifies that URLs in angle brackets are moved to new indented lines, which is appropriate behaviour for footnote formatting.


208-227: Footnote collection regression test ensures stability.

This test correctly verifies that a collection of footnotes remains unchanged when processed, serving as an important regression check.


229-237: Short list item test verifies no unnecessary processing.

The test correctly ensures that short list items that don't require wrapping remain unchanged.


239-257: Blockquote wrapping test demonstrates prefix preservation.

The test correctly verifies that blockquote prefixes are maintained across wrapped lines with expected output verification.


259-277: Nested blockquote test handles complex indentation.

This test correctly verifies that multi-level blockquote nesting is preserved during wrapping operations.


279-297: Mixed indentation blockquote test addresses edge case.

The test correctly handles blockquotes with both spaces and tabs in their prefixes, ensuring proper formatting preservation.


299-322: Blockquote with blank lines test verifies complex structure.

This test correctly ensures that blank lines within blockquotes are preserved during wrapping operations, using appropriate slice indexing for verification.


324-342: Extra whitespace blockquote test handles formatting edge case.

The test correctly verifies that additional spaces in blockquote prefixes are preserved during wrapping.


344-352: Short blockquote test ensures no unnecessary processing.

This test correctly verifies that short blockquotes remain unchanged when processed.


354-365: Hard line break preservation test addresses important edge case.

The test correctly verifies that trailing spaces (Markdown hard line breaks) are handled appropriately during processing.


367-376: Backslash hard line break test uses external data files.

The test correctly uses the include_lines! macro to load test data from external files, which is appropriate for complex test scenarios.


378-402: Backslash edge cases test covers comprehensive scenarios.

This test correctly handles various backslash scenarios including multiple backslashes, isolated backslashes, and trailing spaces with expected output verification.


404-426: CLI wrap option test correctly verifies command-line functionality.

The test properly uses the Command::cargo_bin approach to test CLI functionality with appropriate error handling using expect() calls. The assertions correctly verify multi-line output and line length limits.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/refactor-integration-tests-by-feature

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @leynos - I've reviewed your changes - here's some feedback:

  • Many of the renumbering tests are nearly identical—consider converting them into a single parameterized rstest to cut down on boilerplate and make it easier to add new cases.
  • I noticed some tests still use manual include_str! + .lines().map(...) to build Vec—for consistency you could switch those to the include_lines! macro from tests/common.
  • Every file currently starts with #[macro_use] mod common; use assert_cmd::Command;—you might introduce a small test-prelude module that re-exports common macros and Command to simplify those imports.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Many of the renumbering tests are nearly identical—consider converting them into a single parameterized rstest to cut down on boilerplate and make it easier to add new cases.
- I noticed some tests still use manual include_str! + .lines().map(...) to build Vec<String>—for consistency you could switch those to the include_lines! macro from tests/common.
- Every file currently starts with `#[macro_use] mod common; use assert_cmd::Command;`—you might introduce a small test-prelude module that re-exports common macros and Command to simplify those imports.

## Individual Comments

### Comment 1
<location> `tests/table.rs:212` </location>
<code_context>
+#[macro_use]
+mod common;
+
+#[test]
+fn test_format_breaks_basic() {
+    let input = lines_vec!["foo", "***", "bar"];
</code_context>

<issue_to_address>
Consider adding a test for input with only whitespace or empty lines.

Please add a test to verify that process_stream handles whitespace-only or empty line input without errors or unintended changes.
</issue_to_address>

### Comment 2
<location> `tests/wrap.rs:14` </location>
<code_context>
-///
-/// Ensures that a single long paragraph is split into multiple lines, each not exceeding 80
-/// characters.
-fn test_wrap_paragraph() {
-    let input = lines_vec![
-        "This is a very long paragraph that should be wrapped at eighty columns so it needs to \
-         contain enough words to exceed that limit.",
-    ];
-    let output = process_stream(&input);
-    assert!(output.len() > 1);
-    assert!(output.iter().all(|l| l.len() <= 80));
-}
-
</code_context>

<issue_to_address>
Add a test for paragraphs with very long words (no spaces).

Please add a test case with a single word exceeding 80 characters to verify correct handling by the wrapping logic.

Suggested implementation:

```rust
fn test_wrap_paragraph() {
    let input = lines_vec![

```

```rust
fn test_wrap_paragraph() {
    let input = lines_vec![
        "This is a very long paragraph that should be wrapped at eighty columns so it needs to \
         contain enough words to exceed that limit.",
    ];
    let output = process_stream(&input);
    assert!(output.len() > 1);
    assert!(output.iter().all(|l| l.len() <= 80));
}

///
/// Ensures that a paragraph with a single word longer than 80 characters is handled correctly.
#[test]
fn test_wrap_paragraph_with_long_word() {
    let long_word = "a".repeat(100);
    let input = lines_vec![&long_word];
    let output = process_stream(&input);
    // The output should contain the long word, possibly unbroken, and not panic or error.
    assert_eq!(output.len(), 1);
    assert_eq!(output[0], long_word);
}

```
</issue_to_address>

### Comment 3
<location> `tests/wrap.rs:204` </location>
<code_context>
-}
-
-#[test]
-fn test_wrap_blockquote_nested() {
-    let input = lines_vec![concat!(
-        "> > This nested quote contains enough text to require wrapping so that we ",
-        "can verify multi-level handling."
-    )];
-    let output = process_stream(&input);
-    common::assert_wrapped_blockquote(&output, "> > ", 2);
-    let joined = output
-        .iter()
-        .map(|l| l.trim_start_matches("> > "))
-        .collect::<Vec<_>>()
-        .join(" ");
-    assert_eq!(joined, input[0].trim_start_matches("> > "));
-}
-
</code_context>

<issue_to_address>
Consider adding a test for blockquotes with mixed indentation (spaces and tabs).

Add a test case with blockquotes using both spaces and tabs in the prefix to verify correct handling of mixed indentation.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
}
=======
}

#[test]
fn test_wrap_blockquote_mixed_indentation() {
    // This test checks blockquotes with mixed spaces and tabs in the prefix
    let input = lines_vec![
        "> \t> \tThis blockquote uses both spaces and tabs in the prefix to test mixed indentation handling."
    ];
    let output = process_stream(&input);
    // The expected prefix is "> \t> \t"
    common::assert_wrapped_blockquote(&output, "> \t> \t", 2);
    let joined = output
        .iter()
        .map(|l| l.trim_start_matches("> \t> \t"))
        .collect::<Vec<_>>()
        .join(" ");
    assert_eq!(joined, input[0].trim_start_matches("> \t> \t"));
}
>>>>>>> REPLACE

</suggested_fix>

### Comment 4
<location> `tests/cli.rs:101` </location>
<code_context>
+}
+
+#[test]
+fn test_cli_ellipsis_long_sequence() {
+    let output = Command::cargo_bin("mdtablefix")
+        .unwrap()
+        .arg("--ellipsis")
+        .write_stdin("wait....\n")
+        .output()
+        .unwrap();
+    assert!(output.status.success());
+    assert_eq!(String::from_utf8_lossy(&output.stdout), "wait….\n");
+}
</code_context>

<issue_to_address>
Consider adding a test for ellipsis replacement in a line with multiple ellipsis sequences.

Add a test case with a line containing multiple '...' sequences to verify correct handling by the --ellipsis option.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
#[test]
fn test_cli_ellipsis_long_sequence() {
    let output = Command::cargo_bin("mdtablefix")
        .unwrap()
        .arg("--ellipsis")
        .write_stdin("wait....\n")
        .output()
        .unwrap();
    assert!(output.status.success());
    assert_eq!(String::from_utf8_lossy(&output.stdout), "wait….\n");
}
=======
#[test]
fn test_cli_ellipsis_long_sequence() {
    let output = Command::cargo_bin("mdtablefix")
        .unwrap()
        .arg("--ellipsis")
        .write_stdin("wait....\n")
        .output()
        .unwrap();
    assert!(output.status.success());
    assert_eq!(String::from_utf8_lossy(&output.stdout), "wait….\n");
}

#[test]
fn test_cli_ellipsis_multiple_sequences() {
    let output = Command::cargo_bin("mdtablefix")
        .unwrap()
        .arg("--ellipsis")
        .write_stdin("First... then second... done.\n")
        .output()
        .unwrap();
    assert!(output.status.success());
    assert_eq!(
        String::from_utf8_lossy(&output.stdout),
        "First… then second… done.\n"
    );
}
>>>>>>> REPLACE

</suggested_fix>

### Comment 5
<location> `tests/breaks.rs:39` </location>
<code_context>
+}
+
+#[test]
+fn test_format_breaks_with_spaces_and_indent() {
+    let input = lines_vec!["  -  -  -  "];
+    let expected: Vec<Cow<str>> = vec![Cow::Owned("_".repeat(THEMATIC_BREAK_LEN))];
+    assert_eq!(format_breaks(&input), expected);
+}
+
</code_context>

<issue_to_address>
Consider adding a test for thematic breaks with mixed characters and excessive length.

Please add a test case for thematic breaks that use a mix of valid characters and exceed the standard length, such as '***---___'.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
#[test]
fn test_format_breaks_with_spaces_and_indent() {
    let input = lines_vec!["  -  -  -  "];
    let expected: Vec<Cow<str>> = vec![Cow::Owned("_".repeat(THEMATIC_BREAK_LEN))];
    assert_eq!(format_breaks(&input), expected);
}
=======
#[test]
fn test_format_breaks_with_spaces_and_indent() {
    let input = lines_vec!["  -  -  -  "];
    let expected: Vec<Cow<str>> = vec![Cow::Owned("_".repeat(THEMATIC_BREAK_LEN))];
    assert_eq!(format_breaks(&input), expected);
}

#[test]
fn test_format_breaks_mixed_chars_excessive_length() {
    let input = lines_vec!["***---___"];
    let expected: Vec<Cow<str>> = vec![Cow::Owned("_".repeat(THEMATIC_BREAK_LEN))];
    assert_eq!(format_breaks(&input), expected);
}
>>>>>>> REPLACE

</suggested_fix>

### Comment 6
<location> `docs/rust-testing-with-rstest-fixtures.md:1359` </location>
<code_context>
+| #[timeout(…)]                | Sets a timeout for an asynchronous test.                                                     |
+| #[files("glob_pattern",…)]   | Injects file paths (or contents, with mode=) matching a glob pattern as test arguments.      |

 By mastering `rstest`, Rust developers can significantly elevate the quality
 and efficiency of their testing practices, leading to more reliable and
--- a/tests/common/mod.rs
</code_context>

<issue_to_address>
The phrase uses 'By mastering', which implies 'you' and should be reworded to avoid 2nd person.

Consider rephrasing to avoid the implied 'you', such as: 'Mastering `rstest` can significantly elevate the quality and efficiency of testing practices for Rust developers, leading to more reliable and maintainable code.'
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/table.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/cli.rs
Comment thread tests/breaks.rs
Comment thread docs/rust-testing-with-rstest-fixtures.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 19

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b51e13 and 68f35d8.

📒 Files selected for processing (8)
  • docs/rust-testing-with-rstest-fixtures.md (1 hunks)
  • tests/breaks.rs (1 hunks)
  • tests/cli.rs (1 hunks)
  • tests/common/mod.rs (4 hunks)
  • tests/integration.rs (0 hunks)
  • tests/lists.rs (2 hunks)
  • tests/table.rs (1 hunks)
  • tests/wrap.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • tests/integration.rs
🧰 Additional context used
📓 Path-based instructions (3)
docs/**/*.md

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md
**/*.md

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md

⚙️ CodeRabbit Configuration File

**/*.rs

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md

⚙️ CodeRabbit Configuration File

🧠 Learnings (1)
docs/rust-testing-with-rstest-fixtures.md (10)
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T00:05:36.858Z
Learning: Compared to standard Rust #[test], rstest provides declarative fixture injection and parameterization, reducing boilerplate and improving test clarity, especially for complex setups and input combinations.
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-26T00:20:29.033Z
Learning: In Rust, the rstest crate enables declarative fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], which inject dependencies as function arguments, improving readability and reducing boilerplate.
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T00:05:37.557Z
Learning: In Rust, the rstest crate enables declarative fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], which inject dependencies as function arguments and generate multiple test cases from a single function.
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-26T00:20:29.033Z
Learning: Fixtures and parameterized arguments (#[case], #[values]) can be combined in the same rstest test function, allowing for expressive and comprehensive test scenarios.
Learnt from: CR
PR: leynos/mdtablefix#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-07-18T21:21:37.726Z
Learning: Applies to docs/**/*.rs : Annotate test functions that use rstest features (fixture injection, parameterization) with `#[rstest]`
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T00:05:36.857Z
Learning: In Rust, the rstest crate enables fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], allowing dependencies to be injected as function arguments for improved readability and reduced boilerplate.
Learnt from: CR
PR: leynos/mdtablefix#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-24T23:09:41.600Z
Learning: Fixtures and parameterized arguments (#[case], #[values]) can be combined in the same rstest test function, allowing for expressive and flexible test scenarios.
Learnt from: CR
PR: leynos/mxd#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T23:40:09.111Z
Learning: In Rust, the rstest crate provides a declarative, macro-based approach to fixture-based and parameterized testing, reducing boilerplate and improving test readability.
Learnt from: CR
PR: leynos/mxd#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T23:40:48.640Z
Learning: In Rust, the rstest crate enables fixture-based and parameterized testing using procedural macros such as #[rstest] and #[fixture], allowing for declarative test setup and dependency injection.
Learnt from: CR
PR: leynos/lille#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-24T18:32:30.955Z
Learning: In Rust, the rstest crate enables fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], allowing dependencies to be injected into test functions as arguments.
🧬 Code Graph Analysis (1)
tests/wrap.rs (2)
src/process.rs (1)
  • process_stream (81-81)
tests/common/mod.rs (2)
  • assert_wrapped_list_item (33-69)
  • assert_wrapped_blockquote (74-79)
⏰ Context from checks skipped due to timeout of 240000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test
🔇 Additional comments (28)
docs/rust-testing-with-rstest-fixtures.md (1)

1348-1357: Approve the Unicode ellipsis enhancement.

The replacement of ASCII ellipsis with Unicode ellipsis (…) improves the visual presentation of the attribute documentation table and follows proper typographical conventions.

tests/breaks.rs (4)

1-11: LGTM on module setup.

Proper module documentation, appropriate imports, and good use of Cow<str> for flexible string handling in tests.


13-22: LGTM on basic format test.

Clear, focused test with appropriate use of standard #[test] since no rstest features are needed.


24-51: LGTM on edge case tests.

Well-structured tests covering important edge cases with clear, focused assertions and appropriate test boundaries.


52-65: LGTM on CLI integration test.

Proper integration test using assert_cmd with appropriate verification of both exit status and output content.

tests/table.rs (7)

1-11: LGTM on module setup.

Proper documentation and imports with appropriate rstest integration.


134-162: LGTM on basic rstest usage.

Excellent use of rstest with proper fixture injection, clear test names, and focused assertions.


163-179: Excellent parameterised testing.

Outstanding use of rstest parameterisation with descriptive case names, eliminating duplication whilst maintaining clear test identification.


181-210: LGTM on code fence handling tests.

Comprehensive coverage of code fence scenarios with realistic test data ensuring table processing correctly ignores fenced content.


212-260: LGTM on uniform width verification.

Thorough integration tests with comprehensive validation of column width consistency using realistic table data.


290-341: LGTM on HTML conversion test structure.

Well-organised separation of test categories with comprehensive edge case coverage and appropriate handling of malformed input.


343-397: LGTM on file-based testing approach.

Excellent use of external test data files for complex scenarios whilst maintaining clean, readable test code.

tests/lists.rs (4)

1-8: LGTM on module setup.

Proper documentation and imports with good separation of unit test logic and CLI testing concerns.


9-63: LGTM on existing unit tests.

Comprehensive coverage of renumbering logic with clear test names and focused assertions covering important edge cases.


64-89: LGTM on new basic functionality tests.

Good addition of basic renumbering tests and CLI integration testing with clear assertions and appropriate test boundaries.


91-135: LGTM on complex scenario coverage.

Excellent coverage of nested lists, indentation variations, and embedded content with realistic test scenarios.

tests/wrap.rs (12)

256-261: Add documentation for the test function.

Missing documentation.

Apply this diff:

+/// Tests that short blockquotes remain unchanged during processing.
+///
+/// Verifies that blockquotes shorter than the wrapping limit are not
+/// modified by the wrapping algorithm.
 #[test]
 fn test_wrap_blockquote_short() {

Likely an incorrect or invalid review comment.


276-281: Add documentation for the test function.

This test needs documentation.

Apply this diff:

+/// Tests that hard line breaks marked with backslashes are handled correctly.
+///
+/// Verifies that lines ending with backslashes (Markdown hard line breaks)
+/// are processed according to the expected behaviour defined in test data files.
 #[test]
 fn test_wrap_hard_linebreak_backslash() {

Likely an incorrect or invalid review comment.


187-201: Add documentation for the test function.

Missing documentation.

Apply this diff:

+/// Tests that blockquotes are wrapped correctly while preserving the quote prefix.
+///
+/// Verifies that when a blockquote line exceeds the character limit,
+/// it is wrapped with the ">" prefix maintained on each line.
 #[test]
 fn test_wrap_blockquote() {

Likely an incorrect or invalid review comment.


24-31: Add documentation for the test function.

Missing documentation for this test function.

Apply this diff:

+/// Tests that bullet list items are wrapped with proper indentation.
+///
+/// Verifies that when a list item exceeds the line length, subsequent lines
+/// are properly indented to maintain list formatting.
 #[test]
 fn test_wrap_list_item() {

Likely an incorrect or invalid review comment.


48-57: Add documentation for the test function.

This test function needs documentation.

Apply this diff:

+/// Tests that inline code spans are preserved during list item wrapping.
+///
+/// Verifies that backtick-delimited code spans are not broken across lines
+/// when wrapping long list items.
 #[test]
 fn test_wrap_preserves_inline_code_spans() {

Likely an incorrect or invalid review comment.


96-116: Add documentation for the test function.

This test lacks documentation.

Apply this diff:

+/// Tests that attribute punctuation in code spans is handled correctly during wrapping.
+///
+/// Verifies that Rust attributes like `#[awt]` and `#[future(awt)]` within code spans
+/// are preserved and wrapped appropriately without breaking the formatting.
 #[test]
 fn test_wrap_future_attribute_punctuation() {

Likely an incorrect or invalid review comment.


240-254: Add documentation for the test function.

This test lacks documentation.

Apply this diff:

+/// Tests that blockquotes with extra whitespace are wrapped correctly.
+///
+/// Verifies that blockquotes with additional spacing after the ">" marker
+/// preserve that spacing when wrapped across multiple lines.
 #[test]
 fn test_wrap_blockquote_extra_whitespace() {

Likely an incorrect or invalid review comment.


283-303: Add documentation for the test function.

Missing documentation.

Apply this diff:

+/// Tests edge cases for hard line breaks with backslashes.
+///
+/// Verifies correct handling of various backslash scenarios including
+/// double backslashes, trailing backslashes, and backslashes with whitespace.
 #[test]
 fn test_wrap_hard_linebreak_backslash_edge_cases() {

Likely an incorrect or invalid review comment.


14-22: Add documentation for the test function.

The test function lacks documentation as required by best practices.

Apply this diff:

+/// Tests that long paragraphs are wrapped correctly at 80-character boundaries.
+///
+/// Verifies that a paragraph exceeding 80 characters is split into multiple lines,
+/// with each line respecting the character limit.
 fn test_wrap_paragraph() {

Likely an incorrect or invalid review comment.


78-94: Add documentation for the test function.

Missing documentation for this test.

Apply this diff:

+/// Tests wrapping of list items containing long inline code spans.
+///
+/// Verifies that when a list item contains a long inline code span,
+/// the wrapping preserves the code span integrity and produces the expected output.
 #[test]
 fn test_wrap_long_inline_code_item() {

Likely an incorrect or invalid review comment.


219-238: Add documentation for the test function.

Missing documentation.

Apply this diff:

+/// Tests that blockquotes with blank lines are wrapped correctly.
+///
+/// Verifies that multi-paragraph blockquotes preserve blank lines
+/// and wrap each paragraph independently while maintaining quote formatting.
 #[test]
 fn test_wrap_blockquote_with_blank_lines() {

Likely an incorrect or invalid review comment.


69-77: Add documentation for the test function.

This test needs documentation.

Apply this diff:

+/// Tests that multiple inline code spans within a line are preserved during wrapping.
+///
+/// Verifies that when multiple code spans exist in a single line, none are
+/// broken across lines during the wrapping process.
 #[test]
 fn test_wrap_multiple_inline_code_spans() {

Likely an incorrect or invalid review comment.

Comment thread tests/common/mod.rs Outdated
Comment thread tests/common/mod.rs Outdated
Comment thread tests/table.rs Outdated
Comment thread tests/lists.rs Outdated
Comment thread tests/cli.rs Outdated
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs Outdated
Comment thread tests/wrap.rs Outdated
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (23)
tests/breaks.rs (1)

51-56: LGTM!

This test correctly addresses the past review comment about testing mixed characters with excessive length. The implementation properly verifies that mixed character patterns remain unchanged.

tests/table.rs (3)

290-294: LGTM!

This test correctly addresses the past review comment about verifying whitespace-only input handling. The implementation properly tests edge cases.


12-12: Remove unnecessary return statements in single-line functions.

The coding guidelines explicitly state "Do not use return in single-line functions." This violates the established standards.

-fn broken_table() -> Vec<String> { return lines_vec!["| A | B |    |", "| 1 | 2 |  | 3 | 4 |"]; }
+fn broken_table() -> Vec<String> { lines_vec!["| A | B |    |", "| 1 | 2 |  | 3 | 4 |"] }
-fn malformed_table() -> Vec<String> { return lines_vec!["| A | |", "| 1 | 2 | 3 |"]; }
+fn malformed_table() -> Vec<String> { lines_vec!["| A | |", "| 1 | 2 | 3 |"] }
-    return lines_vec!["  | I | J |    |", "  | 1 | 2 |  | 3 | 4 |"];
+    lines_vec!["  | I | J |    |", "  | 1 | 2 |  | 3 | 4 |"]

Also applies to: 15-15, 29-29


104-104: Remove unnecessary return statements in single-line functions.

These also violate the coding guideline against using return in single-line functions.

-fn html_table_empty() -> Vec<String> { return lines_vec!["<table></table>"]; }
+fn html_table_empty() -> Vec<String> { lines_vec!["<table></table>"] }
-fn html_table_unclosed() -> Vec<String> { return lines_vec!["<table>", "<tr><td>1</td></tr>"]; }
+fn html_table_unclosed() -> Vec<String> { lines_vec!["<table>", "<tr><td>1</td></tr>"] }

Also applies to: 107-107

tests/common/mod.rs (4)

7-8: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...")] instead.

-#[allow(unused_macros)]
+#[expect(unused_macros, reason = "Used selectively across test modules")]

21-22: Replace #[allow] with #[expect] per coding guidelines.

Same issue as the previous macro - use #[expect] instead of the forbidden #[allow].

-#[allow(unused_macros)]
+#[expect(unused_macros, reason = "Used selectively across test modules")]

39-39: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...")] instead.

-#[allow(dead_code)]
+#[expect(dead_code, reason = "Used selectively across test modules")]

84-84: Replace #[allow] with #[expect] per coding guidelines.

Final instance of the forbidden #[allow] attribute that needs to be replaced.

-#[allow(dead_code)]
+#[expect(dead_code, reason = "Used selectively across test modules")]
tests/cli.rs (9)

1-3: Module documentation needs enhancement.

The module documentation lacks detail about the module's purpose and utility as required by the coding guidelines. Expand the documentation to explain what CLI behaviours are tested and how they relate to the overall application.

-//! Integration tests for remaining CLI behaviour.
-//!
-//! Covers file handling with `--in-place` and ellipsis replacement.
+//! Integration tests for CLI interface behaviour of the `mdtablefix` tool.
+//!
+//! This module validates the command-line interface functionality, including:
+//! - File handling with the `--in-place` flag
+//! - Ellipsis replacement with the `--ellipsis` option
+//! - Error handling for invalid argument combinations
+//! - Processing of Markdown files through the CLI interface

21-26: Move doc comment before function attributes.

The coding guidelines specify that function attributes must be placed after doc comments, not before.

-#[test]
-/// Verifies that the CLI fails when the `--in-place` flag is used without specifying a file.
-///
-/// This test ensures that running `mdtablefix --in-place` without a file argument results in a
-/// command failure.
-fn test_cli_in_place_requires_file() {
+/// Verifies that the CLI fails when the `--in-place` flag is used without specifying a file.
+///
+/// This test ensures that running `mdtablefix --in-place` without a file argument results in a
+/// command failure.
+#[test]
+fn test_cli_in_place_requires_file() {

27-31: Replace .unwrap() with .expect() for better error messages.

The coding guidelines specify preferring .expect() over .unwrap() for better error reporting.

-    Command::cargo_bin("mdtablefix")
-        .unwrap()
+    Command::cargo_bin("mdtablefix")
+        .expect("Failed to create cargo command for mdtablefix")

34-40: Move doc comment before function attributes.

The same issue as above - doc comments must come before attributes.

-#[rstest]
-/// Tests that the CLI processes a file containing a broken Markdown table and outputs the corrected
-/// table to stdout.
-///
-/// This test creates a temporary file with a malformed table, runs the `mdtablefix` binary on it,
-/// and asserts that the output is the expected fixed table.
-fn test_cli_process_file(broken_table: Vec<String>) {
+/// Tests that the CLI processes a file containing a broken Markdown table and outputs the corrected
+/// table to stdout.
+///
+/// This test creates a temporary file with a malformed table, runs the `mdtablefix` binary on it,
+/// and asserts that the output is the expected fixed table.
+#[rstest]
+fn test_cli_process_file(broken_table: Vec<String>) {

41-54: Replace multiple .unwrap() calls with .expect() for better error context.

Multiple unwrap calls lack descriptive error messages.

-    let dir = tempdir().unwrap();
+    let dir = tempdir().expect("Failed to create temporary directory");
     let file_path = dir.path().join("sample.md");
-    let mut f = File::create(&file_path).unwrap();
+    let mut f = File::create(&file_path).expect("Failed to create test file");
     for line in &broken_table {
-        writeln!(f, "{line}").unwrap();
+        writeln!(f, "{line}").expect("Failed to write line to test file");
     }
-    f.flush().unwrap();
+    f.flush().expect("Failed to flush test file");
     drop(f);
     Command::cargo_bin("mdtablefix")
-        .unwrap()
+        .expect("Failed to create cargo command for mdtablefix")

57-67: Add documentation and improve error handling.

The test function lacks documentation and uses unwrap calls without descriptive messages.

+/// Tests that the `--ellipsis` option replaces triple dots with a Unicode ellipsis character.
+///
+/// Verifies that the CLI correctly processes input containing "..." and outputs "…".
 #[test]
 fn test_cli_ellipsis_option() {
     let output = Command::cargo_bin("mdtablefix")
-        .unwrap()
+        .expect("Failed to create cargo command for mdtablefix")
         .arg("--ellipsis")
         .write_stdin("foo...\n")
         .output()
-        .unwrap();
+        .expect("Failed to execute mdtablefix command");

69-82: Add documentation and improve error handling.

Same issues as the previous test function.

+/// Tests that the `--ellipsis` option preserves dots within inline code spans.
+///
+/// Verifies that triple dots inside backtick-delimited code spans are not converted to ellipsis.
 #[test]
 fn test_cli_ellipsis_code_span() {
     let output = Command::cargo_bin("mdtablefix")
-        .unwrap()
+        .expect("Failed to create cargo command for mdtablefix")
         .arg("--ellipsis")
         .write_stdin("before `dots...` after\n")
         .output()
-        .unwrap();
+        .expect("Failed to execute mdtablefix command");

84-97: Add documentation and improve error handling.

Continuing the pattern of missing documentation and poor error handling.

+/// Tests that the `--ellipsis` option preserves dots within fenced code blocks.
+///
+/// Verifies that triple dots inside triple-backtick code blocks are not converted to ellipsis.
 #[test]
 fn test_cli_ellipsis_fenced_block() {
     let output = Command::cargo_bin("mdtablefix")
-        .unwrap()
+        .expect("Failed to create cargo command for mdtablefix")
         .arg("--ellipsis")
         .write_stdin("```\nlet x = ...;\n```\n")
         .output()
-        .unwrap();
+        .expect("Failed to execute mdtablefix command");

99-109: Add documentation and improve error handling.

Final test function with the same issues.

+/// Tests that the `--ellipsis` option handles longer sequences of dots correctly.
+///
+/// Verifies that only the first three dots in a sequence are converted to ellipsis,
+/// leaving any additional dots unchanged.
 #[test]
 fn test_cli_ellipsis_long_sequence() {
     let output = Command::cargo_bin("mdtablefix")
-        .unwrap()
+        .expect("Failed to create cargo command for mdtablefix")
         .arg("--ellipsis")
         .write_stdin("wait....\n")
         .output()
-        .unwrap();
+        .expect("Failed to execute mdtablefix command");
tests/wrap.rs (6)

1-4: Module documentation needs enhancement.

The module documentation lacks sufficient detail about the module's purpose and utility as required by the coding guidelines.

-//! Integration tests for wrapping behaviour.
-//!
-//! Covers paragraphs, list items, blockquotes and footnotes,
-//! including the `--wrap` CLI option.
+//! Integration tests for text wrapping behaviour in Markdown content.
+//!
+//! This module validates the wrapping functionality of the `mdtablefix` tool, including:
+//! - Paragraph wrapping at 80-character boundaries
+//! - List item wrapping with proper indentation preservation
+//! - Blockquote wrapping with prefix maintenance
+//! - Footnote wrapping with correct formatting
+//! - Preservation of inline code spans during wrapping
+//! - Hard line break handling and preservation
+//! - CLI `--wrap` option functionality

11-12: Fix formatting issue.

There's an improper line break between the mod common; declaration and the #[test] attribute.

 #[macro_use]
 mod common;
-#[test]
 
+#[test]

69-77: Add documentation for the test function.

Missing documentation.

+/// Tests that multi-backtick code spans are preserved during wrapping.
+///
+/// Verifies that code spans using multiple backticks (``cmd``, ```echo```)
+/// are not broken when wrapping list items.
 #[test]
 fn test_wrap_multi_backtick_code() {

98-104: Replace .expect() with more descriptive message.

The error message could be more specific about what the test expects.

         output
             .first()
-            .expect("output should not be empty")
+            .expect("wrapped output should contain at least one line")

213-227: Add documentation for the test function.

This test needs documentation.

+/// Tests that nested blockquotes are wrapped correctly.
+///
+/// Verifies that multi-level blockquotes ("> > ") maintain their nesting
+/// structure when wrapped across multiple lines.
 #[test]
 fn test_wrap_blockquote_nested() {

331-349: Add documentation and improve error handling.

The test function lacks documentation and uses unwrap calls.

+/// Tests that the CLI `--wrap` option enables wrapping functionality.
+///
+/// Verifies that when the `--wrap` flag is provided, the CLI tool wraps
+/// long lines at 80 characters and produces multi-line output.
 #[test]
 fn test_cli_wrap_option() {
     let input = "This line is deliberately made much longer than eighty columns so that the \
                  wrapping algorithm is forced to insert a soft line-break somewhere in the middle \
                  of the paragraph when the --wrap flag is supplied.";
     let output = Command::cargo_bin("mdtablefix")
-        .unwrap()
+        .expect("Failed to create cargo command for mdtablefix")
         .arg("--wrap")
         .write_stdin(format!("{input}\n"))
         .output()
-        .unwrap();
+        .expect("Failed to execute mdtablefix command");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68f35d8 and a05a251.

📒 Files selected for processing (8)
  • docs/rust-testing-with-rstest-fixtures.md (1 hunks)
  • tests/breaks.rs (1 hunks)
  • tests/cli.rs (1 hunks)
  • tests/common/mod.rs (4 hunks)
  • tests/lists.rs (2 hunks)
  • tests/prelude.rs (1 hunks)
  • tests/table.rs (1 hunks)
  • tests/wrap.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md

⚙️ CodeRabbit Configuration File

docs/**/*.md

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md
**/*.md

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md

⚙️ CodeRabbit Configuration File

🧠 Learnings (1)
docs/rust-testing-with-rstest-fixtures.md (10)
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T00:05:36.858Z
Learning: Compared to standard Rust #[test], rstest provides declarative fixture injection and parameterization, reducing boilerplate and improving test clarity, especially for complex setups and input combinations.
Learnt from: CR
PR: leynos/mxd#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T23:40:09.111Z
Learning: In Rust, the rstest crate provides a declarative, macro-based approach to fixture-based and parameterized testing, reducing boilerplate and improving test readability.
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-26T00:20:29.033Z
Learning: In Rust, the rstest crate enables declarative fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], which inject dependencies as function arguments, improving readability and reducing boilerplate.
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T00:05:36.857Z
Learning: In Rust, the rstest crate enables fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], allowing dependencies to be injected as function arguments for improved readability and reduced boilerplate.
Learnt from: CR
PR: leynos/femtologging#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T00:05:37.557Z
Learning: In Rust, the rstest crate enables declarative fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], which inject dependencies as function arguments and generate multiple test cases from a single function.
Learnt from: CR
PR: leynos/mxd#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-25T23:40:48.640Z
Learning: In Rust, the rstest crate enables fixture-based and parameterized testing using procedural macros such as #[rstest] and #[fixture], allowing for declarative test setup and dependency injection.
Learnt from: CR
PR: leynos/lille#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-07-07T22:05:30.492Z
Learning: Use `rstest` for tests with complex setup, parameterization, or where improved readability and reduced boilerplate are desired; for simple unit tests, standard `#[test]` may suffice.
Learnt from: CR
PR: leynos/lille#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-24T18:32:30.955Z
Learning: In Rust, the rstest crate enables fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], allowing dependencies to be injected into test functions as arguments.
Learnt from: CR
PR: leynos/mdtablefix#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-24T23:09:41.600Z
Learning: In Rust, the rstest crate enables fixture-based and parameterized testing using procedural macros like #[rstest] and #[fixture], which inject dependencies into test functions by matching argument names to fixture functions.
Learnt from: CR
PR: leynos/lille#0
File: docs/rust-testing-with-rstest-fixtures.md:0-0
Timestamp: 2025-06-24T18:32:30.955Z
Learning: rstest is most beneficial for complex setups, parameterized testing, and when aiming for readable, DRY, and maintainable test suites; for trivial tests, standard #[test] may suffice.
🧬 Code Graph Analysis (2)
tests/cli.rs (1)
tests/table.rs (1)
  • broken_table (12-12)
tests/wrap.rs (2)
src/process.rs (1)
  • process_stream (81-81)
tests/common/mod.rs (2)
  • assert_wrapped_list_item (40-76)
  • assert_wrapped_blockquote (85-90)
🔇 Additional comments (15)
tests/prelude.rs (1)

6-7: LGTM!

The module path declaration is clean and follows standard Rust patterns for organising shared test utilities.

tests/breaks.rs (3)

1-11: LGTM!

The module documentation clearly explains the purpose and the imports are well-organised and necessary for the tests.


12-49: LGTM!

The test functions are well-structured and cover important scenarios including basic formatting, code block ignoring, mixed characters, and various whitespace handling.


58-71: LGTM!

The CLI test properly exercises the --breaks option with appropriate input/output verification using assert_cmd patterns.

docs/rust-testing-with-rstest-fixtures.md (2)

1348-1358: LGTM!

The replacement of ASCII ellipsis with Unicode ellipsis improves the typographical quality of the documentation without affecting functionality.


1359-1361: LGTM!

The refined wording in the conclusion improves clarity and maintains a professional tone whilst avoiding problematic pronouns.

tests/table.rs (5)

1-10: LGTM!

The module documentation clearly explains the purpose and scope, and the imports are well-organised and necessary for the tests.


133-160: LGTM!

The basic reflow tests are well-structured and comprehensively cover important scenarios including malformed tables, headers, escaped pipes, and indentation preservation.


162-178: LGTM!

Excellent use of rstest parameterisation to efficiently test multiple HTML table variants. The test logic is comprehensive and well-organised.


180-209: LGTM!

The code fence and indented code block tests properly verify that processing correctly ignores code content, which is essential functionality.


349-403: LGTM!

The data file tests provide excellent regression coverage and complex scenario validation. Using external files keeps the test code clean whilst ensuring comprehensive testing.

tests/lists.rs (3)

1-1: Module documentation is appropriate.

The module documentation clearly states the purpose of this test module.


5-7: Import restructuring looks good.

The migration to a shared prelude module promotes code reuse across test files.


77-115: Excellent use of parameterized testing.

The comprehensive test cases cover a wide range of list renumbering scenarios effectively.

tests/cli.rs (1)

13-19: Fixture definition is clear and appropriate.

The broken_table fixture provides test data in a reusable manner.

Comment thread tests/prelude.rs Outdated
Comment thread tests/lists.rs
Comment thread tests/cli.rs
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 19, 2025

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @leynos - I've reviewed your changes and found some issues that need to be addressed.

  • I see broken_table and a few other fixtures defined in multiple modules—consider centralizing common fixtures in tests/common to avoid duplication.
  • Each test file repeats mod prelude; use prelude::*; use rstest::rstest; — you could re-export rstest and even assert_cmd::Command from your prelude to DRY up these imports.
  • The test macros in tests/common are marked #[macro_export], which makes them part of your library’s public API—consider using #[macro_use] within the test crate instead to keep them scoped to tests.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- I see `broken_table` and a few other fixtures defined in multiple modules—consider centralizing common fixtures in `tests/common` to avoid duplication.
- Each test file repeats `mod prelude; use prelude::*; use rstest::rstest;` — you could re-export `rstest` and even `assert_cmd::Command` from your `prelude` to DRY up these imports.
- The test macros in `tests/common` are marked `#[macro_export]`, which makes them part of your library’s public API—consider using `#[macro_use]` within the test crate instead to keep them scoped to tests.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 19, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

🔭 Outside diff range comments (3)
tests/lists.rs (3)

18-19: Fix formatting issue with test attribute placement.

The #[test] attribute appears to be incorrectly positioned with an empty line between the module declaration and the test function.

Apply this diff to correct the formatting:

 use prelude::*;
-#[test]
-
+
+#[test]
 fn test_wrap_paragraph() {

20-28: Add documentation for the test function.

Missing documentation for the test function explaining its purpose.

Apply this diff:

+/// Tests that long paragraphs are wrapped at 80-character boundaries.
+///
+/// Verifies that a paragraph exceeding 80 characters is split into multiple lines,
+/// each not exceeding the limit.
 #[test]
 fn test_wrap_paragraph() {

41-48: Add documentation for the test function.

Missing documentation explaining the test purpose.

Apply this diff:

+/// Tests that list items are wrapped whilst preserving prefix formatting.
+///
+/// Verifies that long bullet point items are correctly wrapped across multiple lines
+/// with proper indentation maintained.
 #[test]
 fn test_wrap_list_item() {
♻️ Duplicate comments (7)
tests/breaks.rs (1)

52-56: Past review suggestion already implemented.

The test for mixed characters with excessive length that was suggested in a previous review is already present and correctly implemented.

tests/common/mod.rs (4)

7-8: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...")] instead.

Apply this diff:

-#[allow(unused_macros)] // macros are optional helpers across modules
+#[expect(unused_macros, reason = "macros are optional helpers across modules")]

21-22: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...")] instead.

Apply this diff:

-#[allow(unused_macros)] // macros are optional helpers across modules
+#[expect(unused_macros, reason = "macros are optional helpers across modules")]

39-39: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...")] instead.

Apply this diff:

-#[allow(dead_code)] // helper used selectively across modules
+#[expect(dead_code, reason = "helper used selectively across modules")]

84-84: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...")] instead.

Apply this diff:

-#[allow(dead_code)] // helper used selectively across modules
+#[expect(dead_code, reason = "helper used selectively across modules")]
tests/table.rs (1)

302-307: Past review suggestion already implemented.

The test for whitespace-only input that was suggested in a previous review is already present in test_process_stream_only_whitespace.

tests/lists.rs (1)

64-75: Add documentation for the CLI test function.

The test function lacks documentation explaining its purpose and behaviour.

This is similar to past review comments that requested documentation for CLI test functions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a05a251 and ae2f17b.

📒 Files selected for processing (8)
  • src/main.rs (1 hunks)
  • tests/breaks.rs (1 hunks)
  • tests/cli.rs (1 hunks)
  • tests/common/mod.rs (4 hunks)
  • tests/lists.rs (2 hunks)
  • tests/prelude/mod.rs (1 hunks)
  • tests/table.rs (1 hunks)
  • tests/wrap.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

🧬 Code Graph Analysis (1)
tests/cli.rs (2)
tests/table.rs (1)
  • broken_table (12-15)
tests/wrap.rs (3)
  • output (236-239)
  • output (252-255)
  • output (289-292)
🔇 Additional comments (8)
tests/prelude/mod.rs (1)

1-8: LGTM! Well-structured prelude module.

The module documentation clearly explains its purpose, and the re-export pattern for test utilities is appropriate.

src/main.rs (1)

24-27: Excellent compliance with coding guidelines.

The replacement of #[allow] with #[expect] and clear reasoning demonstrates proper adherence to the project's linting standards.

tests/breaks.rs (1)

1-76: Comprehensive test coverage for thematic breaks.

The test suite effectively covers all edge cases including code block ignoring, mixed characters, whitespace handling, and CLI integration. The module documentation clearly explains the scope.

tests/table.rs (1)

1-417: Excellent comprehensive test coverage.

The test suite effectively covers all table processing scenarios including reflow, HTML conversion, edge cases, and regression testing. The use of rstest fixtures promotes good test organisation and the external data files provide robust regression coverage.

tests/lists.rs (1)

77-115: Excellent parameterised test structure.

The #[rstest] parameterised test provides comprehensive coverage of different renumbering scenarios with clean, maintainable code structure.

tests/cli.rs (1)

1-143: Excellent CLI test coverage and implementation.

The module provides comprehensive CLI integration tests with proper error handling, detailed documentation, and good use of fixtures. All previously identified issues with documentation, error handling, and attribute placement have been addressed effectively.

tests/wrap.rs (2)

1-12: Excellent module documentation.

The module documentation clearly explains the purpose and scope of the wrapping tests, addressing previous feedback about insufficient detail.


346-368: Excellent CLI integration test with proper documentation.

The CLI wrap option test is well-documented and follows proper error handling patterns with descriptive expect messages.

Comment thread tests/prelude/mod.rs Outdated
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 19, 2025

@coderabbitai pause

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (14)
tests/common/mod.rs (4)

9-9: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...") instead.

Apply this diff:

-#[allow(unused_macros)] // macros are optional helpers across modules
+#[expect(unused_macros, reason = "macros are optional helpers across modules")]

22-22: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...") instead.

Apply this diff:

-#[allow(unused_macros)] // macros are optional helpers across modules
+#[expect(unused_macros, reason = "macros are optional helpers across modules")]

39-39: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...") instead.

Apply this diff:

-#[allow(dead_code)] // helper used selectively across modules
+#[expect(dead_code, reason = "helper used selectively across modules")]

84-84: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...") instead.

Apply this diff:

-#[allow(dead_code)] // helper used selectively across modules
+#[expect(dead_code, reason = "helper used selectively across modules")]
tests/prelude/mod.rs (2)

3-3: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...") instead.

Apply this diff:

-#[allow(unused_imports)] // re-exporting for test modules
+#[expect(unused_imports, reason = "re-exporting for test modules")]

5-5: Replace #[allow] with #[expect] per coding guidelines.

The coding guidelines explicitly forbid #[allow] and require #[expect(lint, reason = "...") instead.

Apply this diff:

-#[allow(unused_imports)]
+#[expect(unused_imports, reason = "re-exporting rstest macros for test modules")]
tests/wrap.rs (8)

18-28: Add documentation for the test function.

The test function lacks documentation explaining its purpose.

 use prelude::*;
+
+/// Tests that long paragraphs are wrapped at 80-character boundaries.
+///
+/// Verifies that a paragraph exceeding 80 characters is split into multiple lines,
+/// each not exceeding the limit.
 #[test]
 fn test_wrap_paragraph() {

41-48: Add documentation for the test function.

Missing documentation explaining the test purpose.

+/// Tests that list items are wrapped whilst preserving prefix formatting.
+///
+/// Verifies that long bullet point items are correctly wrapped across multiple lines
+/// with proper indentation maintained.
 #[test]
 fn test_wrap_list_item() {

65-74: Add documentation for the test function.

Missing documentation for the inline code span preservation test.

+/// Tests that inline code spans are preserved during list item wrapping.
+///
+/// Verifies that backtick-delimited code spans remain intact when wrapping
+/// long list items across multiple lines.
 #[test]
 fn test_wrap_preserves_inline_code_spans() {

90-98: Add documentation for the test function.

Missing documentation for the multiple inline code spans test.

+/// Tests that multiple inline code spans are preserved during wrapping.
+///
+/// Verifies that list items containing multiple code spans are wrapped correctly
+/// without breaking the span boundaries.
 #[test]
 fn test_wrap_multiple_inline_code_spans() {

99-115: Add documentation for the test function.

The test function lacks documentation.

+/// Tests wrapping of list items with long inline code spans.
+///
+/// Verifies that list items containing lengthy code spans are wrapped appropriately
+/// whilst preserving the code span integrity.
 #[test]
 fn test_wrap_long_inline_code_item() {

117-137: Add documentation for the test function.

Missing documentation for the attribute punctuation test.

+/// Tests wrapping of text containing Rust attribute syntax.
+///
+/// Verifies that text with code spans containing attribute syntax like `#[awt]`
+/// is wrapped correctly without breaking the formatting.
 #[test]
 fn test_wrap_future_attribute_punctuation() {

198-206: Fix documentation comment placement.

The documentation comment is placed after the #[test] attribute, violating coding guidelines that require doc comments before attributes.

+/// Verifies that short list items are not wrapped or altered by the stream processing logic.
+///
+/// Ensures that a single-line bullet list item remains unchanged after processing.
 #[test]
-/// Verifies that short list items are not wrapped or altered by the stream processing logic.
-///
-/// Ensures that a single-line bullet list item remains unchanged after processing.
 fn test_wrap_short_list_item() {

304-315: Fix documentation comment placement.

The documentation comment is incorrectly placed after the #[test] attribute.

+/// Tests that lines with hard line breaks (trailing spaces) are preserved after processing.
+///
+/// Ensures that the `process_stream` function does not remove or alter lines ending with Markdown
+/// hard line breaks.
 #[test]
-/// Tests that lines with hard line breaks (trailing spaces) are preserved after processing.
-///
-/// Ensures that the `process_stream` function does not remove or alter lines ending with Markdown
-/// hard line breaks.
 fn test_preserve_hard_line_breaks() {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae2f17b and daca755.

📒 Files selected for processing (7)
  • tests/breaks.rs (1 hunks)
  • tests/cli.rs (1 hunks)
  • tests/common/mod.rs (4 hunks)
  • tests/lists.rs (2 hunks)
  • tests/prelude/mod.rs (1 hunks)
  • tests/table.rs (1 hunks)
  • tests/wrap.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md

⚙️ CodeRabbit Configuration File

🧬 Code Graph Analysis (2)
tests/cli.rs (1)
tests/common/mod.rs (1)
  • broken_table (95-100)
tests/wrap.rs (2)
src/process.rs (1)
  • process_stream (81-81)
tests/common/mod.rs (2)
  • assert_wrapped_list_item (40-76)
  • assert_wrapped_blockquote (85-90)
🔇 Additional comments (5)
tests/breaks.rs (1)

1-77: Well-structured test module with comprehensive coverage.

The test module properly implements integration tests for thematic breaks formatting, includes the previously suggested test case for mixed characters with excessive length, and follows all coding guidelines.

tests/lists.rs (1)

1-116: Excellent test coverage with proper structure.

The test module comprehensively covers list renumbering functionality, properly uses the include_lines! macro for file loading, and correctly uses .expect() with descriptive error messages as per coding guidelines.

tests/table.rs (1)

1-412: Comprehensive test suite with excellent coverage.

The test module provides thorough coverage of table reflow and HTML conversion functionality, including edge cases and regression tests. The code follows all coding guidelines and makes good use of fixtures and parameterized tests.

tests/cli.rs (1)

1-136: All previous review feedback has been properly addressed.

The CLI integration tests are well-structured and comprehensive. The module documentation clearly explains the purpose, all test functions have proper documentation, error handling uses .expect() with descriptive messages, and doc comments are correctly placed before attributes. The tests cover the essential CLI behaviours including file handling, ellipsis replacement, and error scenarios.

tests/wrap.rs (1)

1-368: Comprehensive test coverage for wrapping functionality.

The test module provides excellent coverage of text wrapping behaviour across different Markdown elements. The tests systematically validate paragraph wrapping, list item formatting, blockquote handling, footnote processing, and CLI integration. The use of helper functions from tests/common/mod.rs ensures consistent validation of wrapping rules and line length constraints.

The modular approach separating wrapping tests from other functionality aligns well with the PR's goal of restructuring integration tests by feature.

Comment thread tests/common/mod.rs Outdated
Comment thread tests/prelude/mod.rs Outdated
Comment thread tests/wrap.rs
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 19, 2025

✅ Actions performed

Reviews paused.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 19, 2025

@coderabbitai resume

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 19, 2025

✅ Actions performed

Reviews resumed.

Repository owner deleted a comment from coderabbitai Bot Jul 19, 2025
Repository owner deleted a comment from coderabbitai Bot Jul 19, 2025
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 19, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (8)
tests/wrap.rs (8)

324-329: Add documentation for the test function.

Missing documentation for the short blockquote test.

+/// Tests that short blockquotes remain unchanged after processing.
+///
+/// Verifies that brief quoted text is not altered by the wrapping logic.
 #[test]
 fn test_wrap_blockquote_short() {

263-277: Add documentation for the test function.

Missing documentation for this important mixed indentation test.

+/// Tests blockquote wrapping with mixed spaces and tabs in prefix.
+///
+/// Verifies that blockquotes using both spaces and tabs maintain correct
+/// prefix formatting when wrapped.
 #[test]
 fn test_wrap_blockquote_mixed_indentation() {

164-172: Add documentation for the test function.

Missing documentation explaining that this test verifies footnotes containing inline code are wrapped correctly.

+/// Tests that footnotes containing inline code are wrapped correctly.
+///
+/// Verifies that code spans within footnotes are preserved during wrapping.
 #[test]
 fn test_wrap_footnote_with_inline_code() {

97-105: Add documentation for the test function.

Missing documentation explaining that this test verifies multiple inline code spans are preserved during wrapping.

+/// Tests that multiple inline code spans are preserved during wrapping.
+///
+/// Verifies that list items containing multiple code spans are wrapped correctly
+/// without breaking the span boundaries.
 #[test]
 fn test_wrap_multiple_inline_code_spans() {

344-349: Add documentation for the test function.

Missing documentation for the backslash hard line break test.

+/// Tests wrapping behaviour with backslash hard line breaks.
+///
+/// Verifies that lines ending with backslashes are handled correctly
+/// according to Markdown hard line break rules.
 #[test]
 fn test_wrap_hard_linebreak_backslash() {

351-371: Add documentation for the test function.

Missing documentation for the edge cases test.

+/// Tests edge cases for backslash hard line break handling.
+///
+/// Verifies correct processing of various backslash scenarios including
+/// multiple backslashes, isolated backslashes, and trailing spaces.
 #[test]
 fn test_wrap_hard_linebreak_backslash_edge_cases() {

72-81: Add documentation for the test function.

Missing documentation explaining the test purpose.

+/// Tests that inline code spans are preserved during list item wrapping.
+///
+/// Verifies that backtick-delimited code spans remain intact when wrapping
+/// long list items across multiple lines.
 #[test]
 fn test_wrap_preserves_inline_code_spans() {

106-122: Add documentation for the test function.

Missing documentation for this important edge case test.

+/// Tests wrapping of list items with long inline code spans.
+///
+/// Verifies that list items containing lengthy code spans are wrapped appropriately
+/// whilst preserving the code span integrity.
 #[test]
 fn test_wrap_long_inline_code_item() {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4bb5642 and 8a52a67.

📒 Files selected for processing (1)
  • tests/wrap.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

🧬 Code Graph Analysis (1)
tests/wrap.rs (3)
src/process.rs (1)
  • process_stream (81-81)
tests/common/mod.rs (2)
  • assert_wrapped_list_item (41-77)
  • assert_wrapped_blockquote (86-91)
src/html.rs (1)
  • lines (176-179)
🔇 Additional comments (16)
tests/wrap.rs (16)

1-12: Excellent module documentation.

The documentation clearly explains the module's purpose and comprehensively lists all functionality tested. Well done following the coding guidelines.


13-17: Imports are well-organised.

The prelude pattern provides clean access to common test utilities across modules.


18-31: Solid basic wrapping test.

Clear test logic verifying paragraph wrapping at 80-character boundaries with proper assertions.


33-42: Important edge case well-tested.

Correctly verifies that words longer than 80 characters remain unbroken, which is the expected Markdown behaviour.


44-55: Good use of helper function.

The assert_wrapped_list_item helper provides comprehensive validation while keeping the test clean and focused.


83-95: Comprehensive multi-backtick test.

Excellent coverage of the edge case where code spans use multiple backticks. Documentation is clear and test logic is sound.


150-162: Solid footnote wrapping test.

Clear documentation and proper use of helper function for consistent validation.


174-190: Excellent URL handling test.

Well-documented test covering the specific behaviour of angle-bracketed URLs in footnotes. Clear expected output validation.


192-211: Valuable regression test.

Well-structured regression test ensuring footnote collections remain unchanged. Clear documentation explains the test's purpose.


213-221: Good boundary condition test.

Properly tests that short items requiring no wrapping are left unchanged. Clear documentation and logic.


223-241: Solid blockquote wrapping test.

Clear test with explicit expected output verification. Good coverage of basic blockquote wrapping behaviour.


243-261: Comprehensive nested blockquote test.

Excellent coverage with both helper function validation and additional content verification. Well-documented edge case.


279-302: Sophisticated blank line handling test.

Excellent coverage of complex blockquote scenarios with blank lines. Well-documented with sophisticated validation logic.


304-322: Well-documented extra whitespace test.

Clear test covering blockquotes with additional spacing. Good use of content verification alongside helper function.


331-342: Good hard line break preservation test.

Well-documented test ensuring hard line breaks with trailing spaces are handled correctly.


373-395: Excellent CLI integration test.

Well-documented CLI test with proper error handling using expect() instead of unwrap(). Good verification of both line count and length constraints.

Comment thread tests/wrap.rs
Comment thread tests/wrap.rs
@leynos leynos merged commit 36c8853 into main Jul 19, 2025
2 checks passed
@leynos leynos deleted the codex/refactor-integration-tests-by-feature branch July 19, 2025 11:16
This was referenced Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant