go version go1.7rc3 linux/amd64
package todo_test
import "testing"
func TestIssueFixed(t *testing.T) {
defer func() {
if t.Failed() {
t.Skip("Test failed as expected; see issue XXXXXXXX.")
}
t.Fatal("Test did not fail as expected; please update issue XXXXXXXX.")
}()
t.Log("<no symptoms of issue XXXXXXXX>")
}
func TestIssueOpen(t *testing.T) {
defer func() {
if t.Failed() {
t.Skip("Test failed as expected; see issue XXXXXXXX.")
}
t.Fatal("Test did not fail as expected; please update issue XXXXXXXX.")
}()
t.Error("<symptom of issue XXXXXXXX>")
}
Expected:
$ go test -v todo
=== RUN TestIssueFixed
--- FAIL: TestIssueFixed (0.00s)
todo_test.go:13: <no symptoms of issue XXXXXXXX>
todo_test.go:10: Test did not fail as expected; please update issue XXXXXXXX.
=== RUN TestIssueOpen
--- SKIP: TestIssueOpen (0.00s)
todo_test.go:24: <symptom of issue XXXXXXXX>
todo_test.go:19: Test failed as expected; see issue XXXXXXXX.
FAIL
exit status 1
FAIL todo 0.018s
Actual:
$ go test -v todo
=== RUN TestIssueFixed
--- FAIL: TestIssueFixed (0.00s)
todo_test.go:13: <no symptoms of issue XXXXXXXX>
todo_test.go:10: Test did not fail as expected; please update issue XXXXXXXX.
=== RUN TestIssueOpen
--- FAIL: TestIssueOpen (0.00s)
todo_test.go:24: <symptom of issue XXXXXXXX>
todo_test.go:19: Test failed as expected; see issue XXXXXXXX.
FAIL
exit status 1
FAIL todo 0.031s
I'm guessing this is not actually a bug, but I don't see anything in https://golang.org/pkg/testing/ describing how Skip and Error are supposed to interact. It doesn't seem unreasonable to think that a test could be Skipped after it has already Failed, but that turns out not to be the case as implemented.
Could someone with more in-depth knowledge of the testing package please confirm whether this behavior is intended (and, if so, update the documentation)?
Expected:
Actual:
I'm guessing this is not actually a bug, but I don't see anything in https://golang.org/pkg/testing/ describing how Skip and Error are supposed to interact. It doesn't seem unreasonable to think that a test could be Skipped after it has already Failed, but that turns out not to be the case as implemented.
Could someone with more in-depth knowledge of the testing package please confirm whether this behavior is intended (and, if so, update the documentation)?