package main import "testing" func TestExtractIssueNumberFromBranchName(t *testing.T) { tests := []struct { name string branchName string expected string }{ {"numeric only", "123", "#123"}, {"numeric with suffix", "123-suffix", "#123"}, {"feature prefix", "feature/123", "#123"}, {"feature prefix with suffix", "feature/123-suffix", "#123"}, {"feature prefix with number suffix", "feature/123-2", "#123"}, {"project prefix", "feature/prefix-123", "prefix-123"}, {"project prefix with suffix", "feature/prefix-123-suffix", "prefix-123"}, {"bugfix prefix", "bugfix/123", "#123"}, {"hotfix prefix", "hotfix/456-fix", "#456"}, {"no number", "feature/no-number", ""}, {"empty string", "", ""}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { actual := extractIssueNumberFromBranchName(tt.branchName) if actual != tt.expected { t.Errorf("extractIssueNumberFromBranchName(%q) = %q, expected %q", tt.branchName, actual, tt.expected) } }) } }