Learning GO
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package hello
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSayHello(t *testing.T) {
|
||||
|
||||
subtests := []struct {
|
||||
items []string
|
||||
result string
|
||||
}{
|
||||
{
|
||||
result: "Hello, world!",
|
||||
},
|
||||
{
|
||||
items: []string{"Leena"},
|
||||
result: "Hello, Leena!",
|
||||
},
|
||||
{
|
||||
items: []string{"Zack", "Sami", "Sara"},
|
||||
result: "Hello, Zack, Sami, Sara!",
|
||||
},
|
||||
}
|
||||
for _, st := range subtests {
|
||||
if s := Say(st.items); s != st.result {
|
||||
t.Errorf("wanted %s (%v), got %s", st.result, st.items, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user