You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been relying on this behavior for some time and just assumed that it was always true, but when I looked through the documentation for go help test it doesn't mention this fact at all.
Many benchmarks make this assumption when they load test files from a testdata directory that is relative to the package directory.
Because go test sets the PWD, stuff like this works from anywhere:
rawr@carbonite: /tmp $ go test -c compress/flate
rawr@carbonite: /tmp $ ./flate.test -test.run none -test.bench .
PASS
BenchmarkDecodeDigitsSpeed1e4-4 --- FAIL: BenchmarkDecodeDigitsSpeed1e4-4
reader_test.go:45: open ../testdata/e.txt: no such file or directory
...
I think the fact that the compiled version fails is WAI, but this behavior should be documented.
The text was updated successfully, but these errors were encountered:
Using
go1.5.1
I have been relying on this behavior for some time and just assumed that it was always true, but when I looked through the documentation for
go help test
it doesn't mention this fact at all.Many benchmarks make this assumption when they load test files from a testdata directory that is relative to the package directory.
Because
go test
sets the PWD, stuff like this works from anywhere:But compiling the test binary does not:
I think the fact that the compiled version fails is WAI, but this behavior should be documented.
The text was updated successfully, but these errors were encountered: