checkFailure checks whether a failure is expected.
(t *testing.T, name string, err error)
| 156 | |
| 157 | // checkFailure checks whether a failure is expected. |
| 158 | func (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 | // |
no outgoing calls
no test coverage detected