-
Notifications
You must be signed in to change notification settings - Fork 866
Open
Labels
Description
While working on enhancing the test coverage for directory pattern matching in GitIngest, I encountered discrepancies between the assumptions in the TODO comments and the actual behavior of the pattern matching. Specifically, patterns like src/*
, /src/*
, and src/
do not behave as expected. Below is a summary of the observations and suggested updates for clarity and next steps.
Key Findings
1. Pattern Mismatches
src/*
: Matches all files recursively undersrc/
, instead of just direct children./src/*
: Does not match any files. Leading slashes are not supported.src/
: Does not match recursively. Correct pattern for recursive matching issrc/**
.
2. Cross-Platform Path Separator Issues
- Problem: Path separators were inconsistent across Windows and Unix systems, causing failures in test comparisons.
- Solution: Implemented path normalization using
Path()
to ensure compatibility.
3. Improved Tests
test_include_src_star_pattern
: Correctly verifies thatsrc/*
matches all files recursively undersrc/
.test_include_src_recursive
: Usessrc/**
for explicit recursive matching.- Path normalization fixes ensure the tests work across different platforms.
4. Test Documentation & Structure
- Added descriptive docstrings and improved error messages.
- Utilized set comparisons for more reliable and readable file path verification.
- Comments added to clarify test expectations and behavior.
Conclusion
- Through this testing process, I discovered several differences between the expected and actual behavior of the pattern matching system.
- I proceeded with updating the test cases to reflect the real functionality, so it would help clarify the intended behavior.