我试图让这个测试套件通过命令提示符 (hello-world_test.go):
package helloworld
import "testing"
func TestHelloWorld(t *testing.T) {
output := sayHello()
if "Hello, World!" != output {
t.Fatalf("output: %s\nexpected: Hello,World!", output)
}
}
我的代码如下(helloworld.go):
package helloworld
import "fmt"
func sayHello() {
fmt.Println("Hello, World!")
}
并且通过命令提示符的错误代码是:
C:\Users\Troy\exercism\go\hello-world\go test -v
# _/C_/Users/Troy/exercism/go/hello-world
.\hello-world_test.go:6: sayHello() used as value
FAIL _/C_/Users/Troy/exercism/go/hello-world [build failed]
相关分类