Refactor to use a subtest
This commit is contained in:
parent
a857ef5957
commit
4c1fb0ec5a
|
@ -3,10 +3,12 @@ package main
|
|||
import "testing"
|
||||
|
||||
func TestHello(t *testing.T) {
|
||||
got := Hello("Oliver")
|
||||
want := "Hello, Oliver"
|
||||
t.Run("saying hello to people", func (t *testing.T) {
|
||||
got := Hello("Oliver")
|
||||
want := "Hello, Oliver"
|
||||
|
||||
if got != want {
|
||||
t.Errorf("got %q want %q", got, want)
|
||||
}
|
||||
if got != want {
|
||||
t.Errorf("got %q want %q", got, want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue