From c378329803d145d1e75c542d05ced3a6a1f25cf4 Mon Sep 17 00:00:00 2001 From: Yuki Date: Sat, 14 Jun 2025 00:50:38 +0800 Subject: [PATCH] feat: Add SayHi. Add a new function(lib upgrade). --- hello.go | 4 ++++ hello_test.go | 9 +++++++++ 2 files changed, 13 insertions(+) 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!"