Scanner exclude/include pattern tests lack edge case coverage #56

Closed
opened 2026-07-20 17:14:08 +02:00 by TapTap · 0 comments
Owner

Description

The scanner tests in tests/test_scanner.c only test basic directory scanning (single file, multiple files, subdirectories, empty directory). They do NOT test:

  1. Exclude patterns (the --exclude functionality)
  2. Include patterns (the --include functionality)
  3. Size filtering (--max-size, --min-size)
  4. Metadata collection when enabled
  5. Chunk size boundaries
  6. Pattern with / in paths (the glob_match test covers slash filtering, but the scanner doesn't)

Location

tests/test_scanner.c:125-130

Suggested Fix

Add tests that exercise the scanner's pattern-matching and size-filtering capabilities:

static void test_scanner_exclude_pattern() {
    // Create directory with a.txt and b.txt
    // Configure scanner with exclude pattern "*.txt"
    // Verify only non-.txt files appear in output
}

Also test that patterns are matched against the filename (not full path), and that the scanner correctly handles multiple include patterns as a whitelist.

Severity

Low

Category

Quality

## Description The scanner tests in `tests/test_scanner.c` only test basic directory scanning (single file, multiple files, subdirectories, empty directory). They do NOT test: 1. Exclude patterns (the `--exclude` functionality) 2. Include patterns (the `--include` functionality) 3. Size filtering (`--max-size`, `--min-size`) 4. Metadata collection when enabled 5. Chunk size boundaries 6. Pattern with `/` in paths (the `glob_match` test covers slash filtering, but the scanner doesn't) ## Location `tests/test_scanner.c:125-130` ## Suggested Fix Add tests that exercise the scanner's pattern-matching and size-filtering capabilities: ```c static void test_scanner_exclude_pattern() { // Create directory with a.txt and b.txt // Configure scanner with exclude pattern "*.txt" // Verify only non-.txt files appear in output } ``` Also test that patterns are matched against the filename (not full path), and that the scanner correctly handles multiple include patterns as a whitelist. ## Severity Low ## Category Quality
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#56