learn-go-with-tests/hello_test.go

24 lines
438 B
Go

package main
import "testing"
func TestHello(t *testing.T) {
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)
}
})
t.Run("say 'Hello, World' when an empty string is supplied", func (t *testing.T) {
got := Hello("")
want := "Hello, World"
if got != want {
t.Errorf("got %q want %q", got, want)
}
})
}