Skip to content

Add comprehensive ripgrep compatibility tests - #84

Merged
Shengyu Fu (shengyfu) merged 1 commit into
mainfrom
shengyfu/ripgrep-compat-tests
May 9, 2026
Merged

Add comprehensive ripgrep compatibility tests#84
Shengyu Fu (shengyfu) merged 1 commit into
mainfrom
shengyfu/ripgrep-compat-tests

Conversation

@shengyfu

Copy link
Copy Markdown
Member

Summary

Adds 58 new integration tests to \ grep-cli/tests/ripgrep_compat.rs\ (from 41 → 99 tests), covering ripgrep-compatible CLI flags that were previously untested or weakly tested.

New test coverage

Category Tests
Case-insensitive (-i) 2
Smart case (-S) 3
Fixed strings (-F) 3
Word boundary (-w) 2
Invert match (-v) 2
Only matching (-o) 2
Max count (-m) 2
Count (-c) 2
Files with matches (-l) 2
Multiple patterns (-e) 2
Pattern file (-f) 1
Context lines (-A/-B/-C) 5
JSON output (--json) 4
Vimgrep output (--vimgrep) 2
Trim (--trim) 1
Null separator (-0) 2
Heading (--no-heading) 1
Color (--color never) 1
Hidden (--hidden) 1
No-ignore (--no-ignore) 1
Unrestricted (-u/-uu) 2
Glob negation (!pattern) 1
Combined flag interactions 8
Exit codes & edge cases 7

All 199 workspace tests pass, clippy is clean.

Copilot AI review requested due to automatic review settings May 9, 2026 00:10
@shengyfu
Shengyu Fu (shengyfu) force-pushed the shengyfu/ripgrep-compat-tests branch from e1cf2d1 to 4db670c Compare May 9, 2026 00:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a large set of new integration tests to improve tgrep CLI compatibility coverage with ripgrep-style flags, primarily exercising behavior under --no-index (brute-force) execution.

Changes:

  • Expands tgrep-cli/tests/ripgrep_compat.rs with many new tests covering common ripgrep flags (case handling, fixed strings, word boundary, invert match, context, JSON, vimgrep, trim, null separators, ignore/hidden, and combinations).
  • Adds additional edge-case and exit-code assertions.
Show a summary per file
File Description
tgrep-cli/tests/ripgrep_compat.rs Adds extensive ripgrep-compatibility integration tests across many CLI flags and flag interactions.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

tgrep-cli/tests/ripgrep_compat.rs:1968

  • Same as above: the git init precondition is ignored here. If initialization fails, -u may behave differently (since there’s no repo/.gitignore), making this test environment-dependent. Please assert git init succeeded (or skip when git is unavailable).
        .assert()
        .success()
        .stdout(predicate::str::contains("unrestricted secret"));
}

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread tgrep-cli/tests/ripgrep_compat.rs
Comment thread tgrep-cli/tests/ripgrep_compat.rs
@shengyfu
Shengyu Fu (shengyfu) force-pushed the shengyfu/ripgrep-compat-tests branch from 4db670c to b974d87 Compare May 9, 2026 00:20
Add 74 new integration tests to ripgrep_compat.rs (from 41 to 115),
covering ripgrep-compatible CLI flags that were previously untested:

Brute-force (--no-index) tests:
- Case-insensitive (-i), smart case (-S), fixed strings (-F)
- Word boundary (-w), invert match (-v), only matching (-o)
- Max count (-m), count (-c), files with matches (-l)
- Multiple patterns (-e), pattern file (-f)
- Context lines (-A/-B/-C) with separator verification
- JSON output (--json), vimgrep output (--vimgrep)
- Trim (--trim), null separator (-0), heading (--no-heading)
- Color (--color never), hidden (--hidden), no-ignore (--no-ignore)
- Unrestricted (-u/-uu), glob negation (!pattern)
- Combined flag interactions, exit codes, edge cases

Indexed search tests (16 tests):
- Build a trigram index first, then verify the same flags produce
  correct results through the index path (no --no-index)
- Covers: basic search, case-insensitive, fixed strings, word boundary,
  invert match, files-with/without-match, count, quiet, glob filter,
  only matching, max count, context lines, JSON output, smart case,
  and output suppression flags

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shengyfu
Shengyu Fu (shengyfu) force-pushed the shengyfu/ripgrep-compat-tests branch from b974d87 to 34f251a Compare May 9, 2026 00:29
@shengyfu
Shengyu Fu (shengyfu) merged commit 3b46b60 into main May 9, 2026
9 checks passed
@shengyfu
Shengyu Fu (shengyfu) deleted the shengyfu/ripgrep-compat-tests branch May 9, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants