feat: Add SayHi.
Add a new function(lib upgrade).
This commit is contained in:
parent
e36228b949
commit
c378329803
4
hello.go
4
hello.go
@ -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 + "!"
|
||||||
|
}
|
||||||
|
|||||||
@ -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!"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user