pkg/eval/platform: Add workaround for failing test on gccgo

This commit is contained in:
Shengjing Zhu 2020-07-11 00:32:15 +08:00 committed by Qi Xiao
parent d9454b4f4a
commit b52ca6b530

View File

@ -35,7 +35,10 @@ func TestPlatform(t *testing.T) {
That(`put $platform:os`).Puts(runtime.GOOS),
That(`put $platform:is-windows`).Puts(runtime.GOOS == "windows"),
That(`put $platform:is-unix`).Puts(
runtime.GOOS != "windows" && runtime.GOOS != "plan9" && runtime.GOOS != "js"),
// Convert to bool type explicitly, to workaround gccgo bug.
// https://github.com/golang/go/issues/40152
// TODO(zhsj): remove workaround after gcc 11 is the default in CI.
bool(runtime.GOOS != "windows" && runtime.GOOS != "plan9" && runtime.GOOS != "js")),
// The first time we invoke the mock it acts as if we can't determine
// the hostname. Make sure that is turned into the expected exception.
That(`platform:hostname`).ThrowsCause(