diff --git a/hello.go b/hello.go index 858b457..c469398 100644 --- a/hello.go +++ b/hello.go @@ -3,3 +3,7 @@ package hellogomod func SayHello(name string) string { return "Hello, " + name + "!" } + +func SayHi(name string) string { + return "Hi, " + name + "!" +} diff --git a/hello_test.go b/hello_test.go index 9ece53b..2140cec 100644 --- a/hello_test.go +++ b/hello_test.go @@ -2,6 +2,15 @@ package hellogomod import "testing" +func TestSayHi(t *testing.T) { + s := SayHi("yuki") + want := "Hi, yuki!" + + if s != want { + t.Errorf("return %s, want %s", s, want) + } +} + func TestSayHello(t *testing.T) { s := SayHello("yuki") want := "Hello, yuki!"