changelog generator & diff tool stormlightlabs.github.io/git-storm/
changelog changeset markdown golang git
at main 853 B view raw
1package shared 2 3import "testing" 4 5func TestTitleCase(t *testing.T) { 6 t.Run("Basic", func(t *testing.T) { 7 got := TitleCase("hello world") 8 want := "Hello World" 9 if got != want { 10 t.Fatalf("TitleCase() = %q, want %q", got, want) 11 } 12 }) 13 14 t.Run("MixedCase", func(t *testing.T) { 15 got := TitleCase("go is GREAT") 16 want := "Go Is Great" 17 if got != want { 18 t.Fatalf("TitleCase() = %q, want %q", got, want) 19 } 20 }) 21 22 t.Run("WithPunctuation", func(t *testing.T) { 23 got := TitleCase("don't stop believing") 24 want := "Don't Stop Believing" 25 if got != want { 26 t.Fatalf("TitleCase() = %q, want %q", got, want) 27 } 28 }) 29 30 t.Run("ExtraSpaces", func(t *testing.T) { 31 got := TitleCase(" leading and internal spaces ") 32 if got != " Leading And Internal Spaces " { 33 t.Fatalf("TitleCase() = %q, spacing/words not as expected", got) 34 } 35 }) 36}