chore(test): add a rapid property test for the --file case and backslash rules

Đang mở
#328 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ó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
72/100
Loại issue
Tính năng
Độ 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

Hướng nghiên cứu

Read filterByFile and normalizeNarrowPath in internal/query/node.go, then the two example tests TestCalleesWithTheEndOfAFilePath and TestCalleesWithABackslashFilePath in internal/query/definitions_test.go. Use TestFileSelectionPartitionsTheUnion and the drawGraph generator as the pattern for a rapid.Check test. Done when the new property test checks that the filter keeps exactly the file-bearing nodes whose normalized path contains the normalized hint, and that case and separator changes in the hint keep the same nodes, and go test ./internal/query/ passes.

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?

Add a rapid property test for the --file rules in filterByFile (internal/query/node.go:214). The rules ignore letter case and treat a backslash as a slash, through normalizeNarrowPath (internal/query/node.go:206).

Only two example tests cover these rules: TestCalleesWithTheEndOfAFilePath (internal/query/definitions_test.go:605) and TestCalleesWithABackslashFilePath (internal/query/definitions_test.go:624).

The property: the filter keeps a node that has a file and whose normalized path contains the normalized hint. It drops every other node. A hint that differs only in case or separators keeps the same nodes.

TestFileSelectionPartitionsTheUnion (internal/query/definitions_test.go:932) already uses rapid.Check, but it tests the partition of rows by file. It does not test the case or separator rules. The new test can reuse the graph generator drawGraph (internal/query/definitions_test.go:823).

Why now?

Each case the examples miss can drop rows from callers, callees and impact without an error. filterByFile documents that those commands use it as a hard filter (internal/query/node.go:210). A property test covers every case in the rule, not only the ones someone wrote down.

Issue #221 asks for property tests as part of its test cleanup. This change adds one test and does not change the scope of #221.

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.