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

Aperta Adatta ai principianti
#329 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
testing-qa

Direzione di ricerca

Inizia da writeFiles in internal/wtindex/prepare_test.go (intorno alla riga 22) e dall'helper testtree.Write in internal/testtree/testtree.go, poi confronta come ciascuno crea le directory padre e scrive i file. Aggiungi testtree.WriteInto(t, root, files) e fai in modo che Write deleghi a questa funzione. È completato quando writeFiles viene rimosso, le sue 10 chiamate in prepare_test.go e equality_test.go usano testtree.WriteInto e i test di wtindex continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
0
Fork
0
Merge medio
7h 42m
PR unite (30g)
111

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di seanb4t/codegraph-go

Tutte le issue di seanb4t/codegraph-go

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.