Skip to content

Commit 96aac30

Browse files
hajimehoshiclaude
andcommitted
internal/glfw: explain the xlibcheck test's package
xlibcheck_linbsd_test.go declares package glfw, while every other test in this package declares package glfw_test. Its comment called it a white-box test without saying why an external test package is not an option. State the reason: the test compares the memory layout of the unexported Xlib mirror types against the C headers, and an external test package would need a bridge that assembles the whole comparison table inside package glfw anyway. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 9da54ef commit 96aac30

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

internal/glfw/xlibcheck_linbsd_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
// x11_types_linbsd_test.go cannot cover (its goldens are LP64-only).
2222
//
2323
// The C reference values come from xlibcheck_linbsd.go (cgo lives there, not
24-
// here, because import "C" is not allowed in a _test.go file). This test is a
25-
// white-box (package glfw) test so it can read those unexported values and the
26-
// unexported mirror types directly, without exporting anything.
24+
// here, because import "C" is not allowed in a _test.go file).
25+
//
26+
// This file declares package glfw, unlike the other tests here, which declare
27+
// package glfw_test. What it checks is the memory layout of the unexported
28+
// Xlib mirror types, which no exported API describes: an external test package
29+
// would need a bridge that assembles the whole comparison table inside package
30+
// glfw, leaving the test with nothing but a loop over that table.
2731
//
2832
// Struct sizes catch padding/alignment mistakes on every data model. The field
2933
// offsets are pinned for LP64 by the golden test and, for the mirrors that spell

0 commit comments

Comments
 (0)