Skip to content

test(locallibrary): build the CLI's test helpers only with the features that use them - #343

Merged
botandbang merged 1 commit into
mainfrom
bnb/test-helpers-cfg
Oct 31, 2026
Merged

botandbang merged 1 commit into
mainfrom
bnb/test-helpers-cfg

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

What and why

cargo clippy -p locallibrary-cli --no-default-features --all-targets -- -D warnings failed on with_directory and typed_ahead in apps/locallibrary/tests/it/support.rs being unused: every caller is behind feature = "account". The scheduled feature-powerset job (locallibrary-scheduled.yml) runs that kind of build.

Changed: with_directory gets #[cfg(feature = "account")] and typed_ahead #[cfg(all(unix, feature = "account"))], matching their callers. terminal(), which typed_ahead uses, has other callers and stays as it is.

How it was tested

  • cargo hack clippy -p locallibrary-cli --feature-powerset --all-targets --locked -- -D warnings: all 13 combinations pass; with the gates removed, --no-default-features fails as reported.
  • cargo fmt --all --check, default-feature clippy.

Checklist

  • Tests cover the change

…es that use them

with_directory and typed_ahead are only called from tests behind the account feature,
so --no-default-features builds, and the scheduled feature-powerset run, failed clippy
on them as dead code. Each now has its callers' cfg.
@botandbang
botandbang requested a review from bnb as a code owner October 30, 2026 22:45
@github-actions github-actions Bot added locallibrary locallibrary and the loclib-* crates locallibrary: cli The locallibrary command line tests Tests, fixtures and test harnesses labels Oct 30, 2026
@botandbang
botandbang enabled auto-merge October 30, 2026 23:26
@botandbang

Copy link
Copy Markdown
Contributor Author

Closing and reopening so CI reruns with the destinations test fix (#344) now on main. Branch unchanged.

@botandbang botandbang closed this Oct 31, 2026
auto-merge was automatically disabled October 31, 2026 00:29

Pull request was closed

@botandbang botandbang reopened this Oct 31, 2026
@botandbang
botandbang enabled auto-merge October 31, 2026 00:30
@botandbang botandbang closed this Oct 31, 2026
auto-merge was automatically disabled October 31, 2026 01:01

Pull request was closed

@botandbang botandbang reopened this Oct 31, 2026
@botandbang
botandbang enabled auto-merge October 31, 2026 01:01
@botandbang
botandbang merged commit 862d555 into main Oct 31, 2026
193 of 198 checks passed
@botandbang
botandbang deleted the bnb/test-helpers-cfg branch October 31, 2026 01:47
@github-actions

Copy link
Copy Markdown

Rust coverage

From run 639. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.44% (82873/85047) 96.53% (13210/13685) 95.7% (182241/190426)
Hegel property tests alone 95.58% (81290/85047) 94.28% (12902/13685) 93.68% (178387/190426)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

locallibrary: cli The locallibrary command line locallibrary locallibrary and the loclib-* crates tests Tests, fixtures and test harnesses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants