mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
26 lines
822 B
Go
26 lines
822 B
Go
package helpers
|
|
|
|
import "testing"
|
|
|
|
func TestSanitizedBranchName(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input string
|
|
whitespaceReplacement string
|
|
expected string
|
|
}{
|
|
{name: "default fallback", input: "feature new branch", whitespaceReplacement: "", expected: "feature-new-branch"},
|
|
{name: "custom replacement", input: "feature new branch", whitespaceReplacement: "_", expected: "feature_new_branch"},
|
|
{name: "multiple characters", input: "feature new branch", whitespaceReplacement: "--", expected: "feature--new--branch"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := SanitizedBranchName(tt.input, tt.whitespaceReplacement)
|
|
if got != tt.expected {
|
|
t.Fatalf("expected %q, got %q", tt.expected, got)
|
|
}
|
|
})
|
|
}
|
|
}
|