Skip to content

Commit 347fcee

Browse files
committed
test(flavor): pin support table's element shape, not just outer Array kind
Copilot review on PR #723 flagged that TestSupportTable_IsArrayNotMap only checked reflect.TypeOf(support).Kind() == reflect.Array -- a regression to [flavorCount]map[Feature]bool would still satisfy that check (still an Array at the top level) while reintroducing a per-row map lookup. Assert the element type is itself an Array of bool, not another map. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJTrn4DizYTMdYj4tbswVJ
1 parent 3107dd6 commit 347fcee

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pkg/markdown/flavor/feature_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,15 @@ func TestAllFeaturesComplete(t *testing.T) {
8989
// search beats a map for n < ~100" / small fixed-set guidance.
9090
func TestSupportTable_IsArrayNotMap(t *testing.T) {
9191
typ := reflect.TypeOf(support)
92-
assert.Equal(t, reflect.Array, typ.Kind(),
92+
require.Equal(t, reflect.Array, typ.Kind(),
9393
"support table should be a flat array, not a nested map")
94+
// Pin the element type too: a regression to [flavorCount]map[Feature]bool
95+
// would still satisfy the outer Array check above while reintroducing a
96+
// per-call map lookup for every row.
97+
require.Equal(t, reflect.Array, typ.Elem().Kind(),
98+
"support table's rows should be arrays, not maps")
99+
assert.Equal(t, reflect.Bool, typ.Elem().Elem().Kind(),
100+
"support table should hold bool values directly, not through another indirection")
94101
}
95102

96103
// TestSupports_OutOfRangeReturnsFalse pins Supports' documented

0 commit comments

Comments
 (0)