Skip to content

tests(vcs/file_types): all-scope test claims non-binary/non-symlink filtering but fixture has neither #952

@dekobon

Description

@dekobon

Summary

all_scope_reproduces_the_whole_tree_ranking asserts that --file-types all ranks "every tracked, non-binary, non-symlink file", but the shared fixture contains neither a binary blob nor a symlink, so the production binary/symlink skip is never exercised — a regression in it would pass green.

Location

  • tests/vcs_file_types.rs:31-40 (fixture()), tests/vcs_file_types.rs:75-85 (all_scope_reproduces_the_whole_tree_ranking)

Evidence

The fixture writes only plain UTF-8 text files:

const TRACKED_FILES: &[&str] = &[
    "src/lib.rs", "app/main.py", "README.md",
    "Cargo.toml", "Cargo.lock", "Makefile",
];

fn fixture() -> Repo {
    let repo = Repo::init();
    for rel in TRACKED_FILES {
        repo.write(rel, "one\ntwo\nthree\n");
    }
    ...
}

The all test then asserts:

"`all` ranks every tracked, non-binary, non-symlink file"

But the binary/symlink skip lives in production at src/vcs/git/repo.rs:152, independent of FileTypeScope:

if entry_mode.is_blob() && !entry_mode.is_link() {
    ...
}

Since the fixture has zero binary blobs and zero symlinks, that guard is never triggered. The module doc (lines 2-3) and the assertion message both advertise a binary/symlink contract the suite does not verify.

Expected Behavior

A test whose message claims "non-binary, non-symlink" filtering should include at least one symlink and one binary blob in the tracked set and assert they are excluded under all (the broadest scope, where only the binary/symlink guard — not the extension filter — can drop them).

Actual Behavior

No binary or symlink entry exists in the fixture. Deleting the !entry_mode.is_link() guard (ranking symlinks) or breaking the is_blob() binary handling would leave every test in tests/vcs_file_types.rs green.

Impact

The --file-types extension scoping (issue #576, the suite's primary subject) is well covered and genuinely discriminating. The adjacent enumeration guard at repo.rs:152 — which the all-scope test's own message claims to cover — is untested here, so a silent regression in symlink/binary handling under any scope would not be caught by this suite. Risk is mild (the extension filter is the file's focus) but the assertion message overstates what is verified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions