console/frontend: better error formatting

This commit is contained in:
Vincent Bernat
2022-05-16 21:41:33 +02:00
parent 7f4a34c17e
commit dd64d02b48
8 changed files with 88 additions and 15 deletions

View File

@@ -0,0 +1,22 @@
package helpers
import "testing"
func TestCapitalize(t *testing.T) {
cases := []struct {
In string
Out string
}{
{"", ""},
{"Hello", "Hello"},
{"bye", "Bye"},
{" nothing", " nothing"},
{"école", "École"},
}
for _, tc := range cases {
got := Capitalize(tc.In)
if diff := Diff(got, tc.Out); diff != "" {
t.Errorf("Capitalize(%q) (-got, +want):\n%s", tc.In, diff)
}
}
}