Problem
GCode ships a pure-Python grep fallback (_grep_python) for Windows, but it
is only compared against expected strings, not against a real grep on the
same corpus. Discrepancies in matching (regex flavor, --glob, case
insensitivity, binary detection) go unnoticed.
Proposed approach
- Build a fixture corpus (text, nested dirs, binary file, files matching/not
matching a glob).
- On platforms with
grep, assert _grep_python(...) and grep -r ...
produce equivalent matches for: plain regex, -i, glob filter, no-match.
- Keep tests skippable when
grep isn't available.
Where to look
gcode/tools.py:242-285 (_grep_python), :192-229 (grep tool)
- Existing
tests/test_tools.py grep tests.
Acceptance criteria
- New
tests/test_grep_differential.py passes on macOS/Linux, skips cleanly on Windows.
Difficulty
Low — good first issue.
Problem
GCode ships a pure-Python grep fallback (
_grep_python) for Windows, but itis only compared against expected strings, not against a real
grepon thesame corpus. Discrepancies in matching (regex flavor,
--glob, caseinsensitivity, binary detection) go unnoticed.
Proposed approach
matching a glob).
grep, assert_grep_python(...)andgrep -r ...produce equivalent matches for: plain regex,
-i, glob filter, no-match.grepisn't available.Where to look
gcode/tools.py:242-285(_grep_python),:192-229(grep tool)tests/test_tools.pygrep tests.Acceptance criteria
tests/test_grep_differential.pypasses on macOS/Linux, skips cleanly on Windows.Difficulty
Low — good first issue.