Commits

Atsushi Odagiri committed b365f42

add test

Comments (0)

Files changed (3)

+package main
+
+import "fmt"
+
+func GetMessage(name string) string {
+	return fmt.Sprintf("Hello, %s", name);
+}
+
+func Greeting() {
+	fmt.Printf("%s\n", GetMessage("World"))
+}
+package main
+
+import "testing"
+
+func TestGetMessage(t *testing.T) {
+	const name = "aodag"
+	const expect = "Hello, aodag"
+	result := GetMessage(name);
+	
+	if result != expect {
+		t.Errorf("%s != %s", result, expect)
+	}
+}
 
 package main
 
-import "fmt"
-
 func main() {
-	fmt.Printf("Hello, world.\n")
+	Greeting()
 }