chore(test): replace the wtindex test file writer with testtree

オープン 初心者向け
#329 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
testing-qa

調査の方向性

internal/wtindex/prepare_test.go の writeFiles(22行目付近)と、internal/testtree/testtree.go の testtree.Write ヘルパーから始めて、それぞれが親ディレクトリをどのように作成し、ファイルをどのように書き込むかを比較してください。testtree.WriteInto(t, root, files) を追加し、Write がそれに委譲するようにしてください。writeFiles が削除され、prepare_test.go と equality_test.go にある10箇所の呼び出しが testtree.WriteInto を使用するようになり、wtindex のテストが引き続き成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

area:ci chore priority:low
What kind of chore?

Test infrastructure

What needs doing?

writeFiles in internal/wtindex/prepare_test.go:22 repeats testtree.Write in internal/testtree/testtree.go. Both make the parent directories and write each file.

The copies differ in one way. writeFiles writes into a root that the caller passes, because worktreeFixture (internal/wtindex/prepare_test.go:37) creates the main checkout and the worktree itself. testtree.Write makes its own temporary directory.

Add testtree.WriteInto(t, root, files) and have Write call it. Then delete writeFiles and point its 10 call sites in internal/wtindex/prepare_test.go and internal/wtindex/equality_test.go at testtree.WriteInto.

Why now?

Two copies of the file writer can drift apart. A later fix to one copy will not reach the other. Tidiness is the trigger, so this is lower priority.

Issue #284 tracks the same kind of repeated test helper in other packages.

Does this touch anything load-bearing?
  • The release pipeline (release.yml, .goreleaser.yaml, signing)
  • The upgrade identity (internal/upgrade/verify.go)
  • The perf baseline (tools/bench/baseline.json)
  • The graph schema / meta-key layout
  • None of these
Before submitting
  • I searched existing issues and this is not a duplicate

🤖 Generated with Claude Code

https://claude.ai/code/session_0167DcyoD2LrY4B7TBMiVJT4

主要言語
Go
スター
0
フォーク
0
平均マージ
7時間 42分
マージ済み PR(30日)
111

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

seanb4t/codegraph-go のほかの issue

seanb4t/codegraph-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。