Context
internal/patterns currently has no tests, and internal/gitignore also has no test file.
These two packages are not the same kind of test target:
internal/patterns is straightforward pure matching logic
internal/gitignore is a thin wrapper around git check-ignore plus an in-memory cache
That means the tests should reflect the real implementation rather than treating both packages as pure parsers.
Proposed change
Add test coverage for both packages.
internal/patterns
Cover:
- Basic glob matching
- Recursive
** behavior
* and ? matching
- Empty-pattern behavior and other edge cases
internal/gitignore
Cover:
- Behavior against a temporary git repo with real
.gitignore files
- Ignored vs non-ignored paths using
git check-ignore
- Behavior when
git is unavailable or unusable, if practical to simulate
- Cache behavior at a basic level (for example, repeated calls for the same repo root)
Use Go's built-in testing package.
Why this is a good first issue
- The scope is still fairly self-contained
internal/patterns is an especially approachable unit-test target
internal/gitignore is a good introduction to how this repo wraps existing system tools
Relevant files
internal/patterns/
internal/gitignore/
Context
internal/patternscurrently has no tests, andinternal/gitignorealso has no test file.These two packages are not the same kind of test target:
internal/patternsis straightforward pure matching logicinternal/gitignoreis a thin wrapper aroundgit check-ignoreplus an in-memory cacheThat means the tests should reflect the real implementation rather than treating both packages as pure parsers.
Proposed change
Add test coverage for both packages.
internal/patternsCover:
**behavior*and?matchinginternal/gitignoreCover:
.gitignorefilesgit check-ignoregitis unavailable or unusable, if practical to simulateUse Go's built-in
testingpackage.Why this is a good first issue
internal/patternsis an especially approachable unit-test targetinternal/gitignoreis a good introduction to how this repo wraps existing system toolsRelevant files
internal/patterns/internal/gitignore/