package main import "testing" func TestHello(t *testing.T) { t.Run("say hello to given name", func(t *testing.T) { got := Hello("Judas", "") want := "Hello, Judas" assertCorrectMessage(t, got, want) }) t.Run("hello world on empty string", func(t *testing.T) { got := Hello("", "") want := "Hello, world" assertCorrectMessage(t, got, want) }) t.Run("spanish", func(t *testing.T) { got := Hello("Marjorie", "Spanish") want := "Hola, Marjorie" assertCorrectMessage(t, got, want) }) } func assertCorrectMessage(t testing.TB, got, want string) { t.Helper() if got != want { t.Errorf("got %q want %q", got, want) } }