feat: Add SayHi.

Add a new function(lib upgrade).
This commit is contained in:
Yuki 2025-06-14 00:50:38 +08:00
parent e36228b949
commit c378329803
Signed by: yuki
GPG Key ID: 0E266240CCAD7A90
2 changed files with 13 additions and 0 deletions

View File

@ -3,3 +3,7 @@ package hellogomod
func SayHello(name string) string { func SayHello(name string) string {
return "Hello, " + name + "!" return "Hello, " + name + "!"
} }
func SayHi(name string) string {
return "Hi, " + name + "!"
}

View File

@ -2,6 +2,15 @@ package hellogomod
import "testing" 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) { func TestSayHello(t *testing.T) {
s := SayHello("yuki") s := SayHello("yuki")
want := "Hello, yuki!" want := "Hello, yuki!"