Skip to content

Instantly share code, notes, and snippets.

@umisama
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umisama/cebb1c8f9022e5402d21 to your computer and use it in GitHub Desktop.
Save umisama/cebb1c8f9022e5402d21 to your computer and use it in GitHub Desktop.
testing.Short() returns unexpected value on testing.TestMain(*testing.M). (https://github.com/golang/go/issues/9825)

This repo showing testing.Short() returns unexpected value on testing.TestMain(*testing.M).
please do go test -short.

Here is result in my environment

$ go version
go version go1.4 linux/amd64
$ go test -short
false   on TestMain
true    on TestSomething
PASS
ok      _/home/umisama/testing  0.008s
// This repo showing testing.Short() returns unexpected value on testing.TestMain(*testing.M).
package main
package main
import (
"os"
"testing"
)
func TestMain(m *testing.M) {
println(testing.Short(), "\ton TestMain")
os.Exit(m.Run())
}
func TestSomething(t *testing.T) {
println(testing.Short(), "\ton TestSomething")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment