在以下环境中:
code$ pwd
/home/user1/code
code$ echo $GOPATH
/home/user1/golib:/home/user1/code
code$ ls
bin pkg src
code$ ls src/github.com/myhub/codingtest/
main.go test_main.go
code$
code$
code$
code$
code$
code$ cat src/github.com/myhub/codingtest/test_main.go
package main
import "testing"
func TestSplit(t *testing.T) {
gotAllButLast, gotLast := split(2013)
wantAllButLast := 201
wantLast := 3
if gotAllButLast != wantAllButLast {
t.Errorf("got %d but expected %d", gotAllButLast, wantAllButLast)
}
if wantLast != gotLast {
t.Errorf("got %d but expected %d", gotLast, wantLast)
}
}
code$
code$
code$
code$
code$
code$ cat src/github.com/myhub/codingtest/main.go
package main
// Spit n into all but its last digit and its last digit
func split(n int) (int, int) {
return n / 10, n % 10
}
func main() {
}
code$
go test给出以下错误:
code$ go test github.com/myhub/codingtest
? github.com/myhub/codingtest [no test files]
code$
code$
code$
code$
code$
code$
如何解决no test files error?
当年话下
相关分类