MCPcopy Create free account
hub / github.com/CPChain/chain / checkFailure

Method checkFailure

tests/init_test.go:158–176  ·  view source on GitHub ↗

checkFailure checks whether a failure is expected.

(t *testing.T, name string, err error)

Source from the content-addressed store, hash-verified

156
157// checkFailure checks whether a failure is expected.
158func (tm *testMatcher) checkFailure(t *testing.T, name string, err error) error {
159 // TODO(fjl): name can be derived from t when min Go version is 1.8
160 failReason := ""
161 for _, m := range tm.failpat {
162 if m.p.MatchString(name) {
163 failReason = m.reason
164 break
165 }
166 }
167 if failReason != "" {
168 t.Logf("expected failure: %s", failReason)
169 if err != nil {
170 t.Logf("error: %v", err)
171 return nil
172 }
173 return fmt.Errorf("test succeeded unexpectedly")
174 }
175 return err
176}
177
178// walk invokes its runTest argument for all subtests in the given directory.
179//

Callers 5

TestTransactionFunction · 0.80
TestVMFunction · 0.80
TestBlockchainFunction · 0.80
TestStateFunction · 0.80
TestRLPFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected