Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Possible values for Event.Action. ActionBench = "bench" ActionCont = "cont" ActionFail = "fail" ActionOutput = "output" ActionPass = "pass" ActionPause = "pause" ActionRun = "run" ActionSkip = "skip" )
View Source
const ( PackageFullPath = modulePath + "/go/" + packageName TestName = "TestCase" FailText = "the test failed" ContentFail TestContent = `package test2json_test import "testing" func TestCase(t *testing.T) { t.Fatalf("the test failed") }` ContentPass TestContent = `package test2json_test import "testing" func TestCase(t *testing.T) { t.Log("the test passed") }` ContentSkip TestContent = `package test2json_test import "testing" func TestCase(t *testing.T) { t.Skip("no thanks!") }` ContentNested TestContent = `` /* 476-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func EventStream ¶
EventStream returns a channel which emits Events as they appear on the given io.Reader.
func SetupTest ¶
func SetupTest(content TestContent) (tmpDir string, cleanup func(), err error)
SetupTest sets up a temporary directory containing a test file with the given content so that the caller may run `go test` in the returned directory. Returns the directory path and a cleanup function, or any error which occurred. SetupTest is intended to be used with any of the Content provided above, in which case EventStream/ParseEvent should generate the corresponding sequence of Events from above.
Types ¶
type Event ¶
type Event struct { Time time.Time `json:",omitempty"` Action string Package string `json:",omitempty"` Test string `json:",omitempty"` Elapsed float64 `json:",omitempty"` Output string `json:",omitempty"` }
Event represents a test event.
func ParseEvent ¶
type TestContent ¶
type TestContent string
Click to show internal directories.
Click to hide internal directories.