Refactor to use a subtest

This commit is contained in:
Oliver Davies 2022-01-26 18:00:00 +00:00
parent a857ef5957
commit 4c1fb0ec5a

View file

@ -3,10 +3,12 @@ package main
import "testing" import "testing"
func TestHello(t *testing.T) { func TestHello(t *testing.T) {
t.Run("saying hello to people", func (t *testing.T) {
got := Hello("Oliver") got := Hello("Oliver")
want := "Hello, Oliver" want := "Hello, Oliver"
if got != want { if got != want {
t.Errorf("got %q want %q", got, want) t.Errorf("got %q want %q", got, want)
} }
})
} }