package main import "testing" func TestHello(t *testing.T) { t.Run("Hello someone", func(t *testing.T) { got := Hello("Jason") exp := "Hello Jason" assertCorrectMsg(t, got, exp) }) t.Run("Hello default", func(t *testing.T) { got := Hello("") exp := "Hello world" assertCorrectMsg(t, got, exp) }) } func assertCorrectMsg(t testing.TB, got, exp string) { t.Helper() if got != exp { t.Errorf("got %q expected %q", got, exp) } }