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
Given a test suite with a TestSetup method, if c.Fail() is called on the *C instance captured from the TestSetup method or one of its descendants after TestSetup completes but before the Test method completes, the test is not marked failed.
Consider the following test:
package main
import (
chk "gopkg.in/check.v1""testing"
)
typescratchTeststruct {
c*chk.C
}
// Hookup to the testing frameworkfuncTest(t*testing.T) { chk.TestingT(t) }
var_=chk.Suite(&scratchTest{})
func (s*scratchTest) TestCheckDoesNotFlow(c*chk.C) {
s.doFail()
c.Log("This test should be failing")
}
func (s*scratchTest) SetUpTest(c*chk.C) {
// capture the check test contexts.c=c
}
func (s*scratchTest) doFail() {
s.c.Fail()
}
Actual output:
OK: 1 passed
PASS
ok _/C_/src/goscratch 0.126s
Expected output:
----------------------------------------------------------------------
FAIL: checkrepro_test.go:20: scratchTest.TestCheckDoesNotFlow
This test should be failing
OOPS: 0 passed, 1 FAILED
--- FAIL: Test (0.00s)
FAIL
exit status 1
FAIL chrissscratch.com/scratch 0.105s
The text was updated successfully, but these errors were encountered:
Given a test suite with a TestSetup method, if
c.Fail()
is called on the*C
instance captured from the TestSetup method or one of its descendants after TestSetup completes but before the Test method completes, the test is not marked failed.Consider the following test:
Actual output:
Expected output:
The text was updated successfully, but these errors were encountered: