package pulls import "testing" func TestNormalizeAutoPullBodyTrailers(t *testing.T) { tests := []struct { name string input string want string }{ { name: "trailing trailers are normalized", input: "This is a placeholder commit message with multiple paragraphs\n\nThe content does not matter.\n\nCo-authored-by: Developer One \nReviewed-by: Reviewer Two \nTicket: PROJ-123\n", want: "This is a placeholder commit message with multiple paragraphs\n\nThe content does not matter.\n\nCo-authored-by: Developer One \nReviewed-by: Reviewer Two \nTicket: PROJ-123", }, { name: "regular prose with colons is unchanged", input: "Body\n\nThis line: has extra words and should not match\nsecond plain line", want: "Body\n\nThis line: has extra words and should not match\nsecond plain line", }, { name: "no blank line separator means unchanged", input: "Body\nTicket: PROJ-123", want: "Body\nTicket: PROJ-123", }, { name: "trailer continuation line is normalized", input: "Body\n\nReviewed-by: Reviewer\n\tAdditional context\nTicket: PROJ-123\n", want: "Body\n\nReviewed-by: Reviewer \n\tAdditional context \nTicket: PROJ-123", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := normalizeAutoPullBodyTrailers(tt.input) if got != tt.want { t.Fatalf("normalized body = %q, want %q", got, tt.want) } }) } }