Commit 9b791a5
Changed files (2)
hello.go
@@ -2,6 +2,10 @@ package main
import "fmt"
+func Hello() string {
+ return "Hello, world"
+}
+
func main() {
- fmt.Println("Hello, world")
+ fmt.Println(Hello())
}
hello_test.go
@@ -0,0 +1,12 @@
+package main
+
+import "testing"
+
+func TestHello(t *testing.T) {
+ got := Hello()
+ want := "Hello, world"
+
+ if got != want {
+ t.Errorf("got %q want %q", got, want)
+ }
+}