From 564b644ea9e9540ebd9970efcb64f096acbb7b91 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 07:05:08 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20chore(rfcnotify):=20add=20tests?= =?UTF-8?q?=20for=20card.go=20helper=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds direct unit tests for isRelatedKey and isTableHeaderOrSeparator to pin their behavior. The helpers are used by ParseRFC to identify RFC metadata fields and table structures. Tests cover all key predicate branches to ensure equivalence is maintained during any future refactoring. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/rfcnotify/card_test.go | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/pkg/rfcnotify/card_test.go b/src/pkg/rfcnotify/card_test.go index 4846d270ef..205fb615fb 100644 --- a/src/pkg/rfcnotify/card_test.go +++ b/src/pkg/rfcnotify/card_test.go @@ -535,3 +535,46 @@ func TestCard_BotAuthorOmitsIconURL(t *testing.T) { t.Errorf("IconURL = %q, want empty for [bot] login", card.Author.IconURL) } } + +func TestIsRelatedKey(t *testing.T) { + tests := []struct { + key string + want bool + }{ + {"builds on", true}, + {"supersedes", true}, + {"related", true}, + {"related rfcs", true}, + {"related rfc", true}, + {"related-anything", true}, + {"status", false}, + {"target", false}, + {"field", false}, + {"", false}, + } + for _, tt := range tests { + if got := isRelatedKey(tt.key); got != tt.want { + t.Errorf("isRelatedKey(%q) = %v, want %v", tt.key, got, tt.want) + } + } +} + +func TestIsTableHeaderOrSeparator(t *testing.T) { + tests := []struct { + key, val string + want bool + }{ + {"field", "value", true}, + {"key", "value", true}, + {"---", "value", true}, + {"normal", "---", true}, + {"normal", "value", false}, + {"target", "text", false}, + {"status", "active", false}, + } + for _, tt := range tests { + if got := isTableHeaderOrSeparator(tt.key, tt.val); got != tt.want { + t.Errorf("isTableHeaderOrSeparator(%q, %q) = %v, want %v", tt.key, tt.val, got, tt.want) + } + } +}