Commit 9b791a5

mo khan <mo.khan@gmail.com>
2019-10-19 22:01:23
Add a unit test
1 parent 57d4f8a
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)
+  }
+}