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

Đang mở Phù hợp với người mới
#329 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu từ writeFiles trong internal/wtindex/prepare_test.go (khoảng dòng 22) và hàm trợ giúp testtree.Write trong internal/testtree/testtree.go, sau đó so sánh cách mỗi hàm tạo thư mục cha và ghi tệp. Thêm testtree.WriteInto(t, root, files) và để Write ủy quyền cho hàm này. Hoàn thành khi writeFiles được xóa, 10 lệnh gọi của nó trong prepare_test.go và equality_test.go dùng testtree.WriteInto, và các kiểm thử wtindex vẫn pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Go
Star
0
Fork
0
Merge trung bình
7 giờ 42 phút
Pull request đã merge (30 ngày)
111

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của seanb4t/codegraph-go

Tất cả issue của seanb4t/codegraph-go

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.