Skip to content

fix(hooks): resolve Rust integration test targets inside tests subdirectories - #304

Merged
furedea merged 2 commits into
mainfrom
fix/rust-test-target
Oct 22, 2026
Merged

furedea merged 2 commits into
mainfrom
fix/rust-test-target

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

概要

検証 hook の rust_plan が,tests/<dir>/<file>.rs の変更に対しても cargo test --test <file> を実行し,存在しないテスト名で失敗していた.変更されたファイルを含む統合テストのターゲットを解決するようにした.

  1. Cargo.toml の [[test]] に path があれば,そのファイルまたはディレクトリを含むエントリの name を使う(tomllib で解析).
  2. なければ Cargo の自動検出に従う(tests/<name>.rs → <name>,tests/<dir>/main.rs があれば <dir>).
  3. 決められなければ crate 全体のテスト(RUST_FULL_SUITE)にする.

変更前後

変更前 変更後
tests/foo.rs を変更 --test foo --test foo(変わらない)
tests/<dir>/<file>.rs を変更 --test <file>(存在せず失敗) [[test]] の name,なければ <dir>
どのテストか決められない — crate 全体のテスト

受け入れ条件

  • tests/<dir>/<file>.rs の変更で,そのファイルを含むテストが実行される
  • Cargo.toml の [[test]] の name と path が考慮される
  • 決められないときは crate 全体のテストになる
  • テストがある

Closes #303

🤖 Generated with Claude Code

furedea and others added 2 commits October 23, 2026 02:14
…ectories

Map a changed tests/<dir>/<file>.rs to the target that contains it, using
Cargo.toml [[test]] name/path first, then Cargo auto-discovery, and fall
back to the full suite when no target can be determined.

Closes #303

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Match a declared [[test]] path exactly unless it lives in a subdirectory
of tests/, prefer the most specific declaration, and fall back to the
full suite when Cargo.toml cannot be read or parsed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@furedea
furedea merged commit af761f8 into main Oct 22, 2026
11 checks passed
@furedea
furedea deleted the fix/rust-test-target branch October 22, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

検証 hook が tests/ のサブディレクトリにある Rust のテストを,存在しないテスト名で実行する

1 participant