Refactor to use a subtest
This commit is contained in:
parent
a857ef5957
commit
4c1fb0ec5a
|
@ -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)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue