Add test
This commit is contained in:
parent
b985c2d4ba
commit
77e6cc55b7
8
hello.go
8
hello.go
|
@ -2,6 +2,10 @@ package main
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func main() {
|
func Hello() string {
|
||||||
fmt.Println("Hello, world")
|
return "Hello, world"
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println(Hello())
|
||||||
}
|
}
|
||||||
|
|
12
hello_test.go
Normal file
12
hello_test.go
Normal file
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue