@@ -212,6 +212,10 @@ func (c *common) Failed() bool {
212
212
213
213
// FailNow marks the function as having failed and stops its execution.
214
214
// Execution will continue at the next test or benchmark.
215
+ // FailNow must be called from the goroutine running the
216
+ // test or benchmark function, not from other goroutines
217
+ // created during the test. Calling FailNow does not stop
218
+ // those other goroutines.
215
219
func (c * common ) FailNow () {
216
220
c .Fail ()
217
221
@@ -244,33 +248,33 @@ func (c *common) log(s string) {
244
248
c .output = append (c .output , decorate (s )... )
245
249
}
246
250
247
- // Log formats its arguments using default formatting, analogous to Println() ,
251
+ // Log formats its arguments using default formatting, analogous to Println,
248
252
// and records the text in the error log.
249
253
func (c * common ) Log (args ... interface {}) { c .log (fmt .Sprintln (args ... )) }
250
254
251
- // Logf formats its arguments according to the format, analogous to Printf() ,
255
+ // Logf formats its arguments according to the format, analogous to Printf,
252
256
// and records the text in the error log.
253
257
func (c * common ) Logf (format string , args ... interface {}) { c .log (fmt .Sprintf (format , args ... )) }
254
258
255
- // Error is equivalent to Log() followed by Fail() .
259
+ // Error is equivalent to Log followed by Fail.
256
260
func (c * common ) Error (args ... interface {}) {
257
261
c .log (fmt .Sprintln (args ... ))
258
262
c .Fail ()
259
263
}
260
264
261
- // Errorf is equivalent to Logf() followed by Fail() .
265
+ // Errorf is equivalent to Logf followed by Fail.
262
266
func (c * common ) Errorf (format string , args ... interface {}) {
263
267
c .log (fmt .Sprintf (format , args ... ))
264
268
c .Fail ()
265
269
}
266
270
267
- // Fatal is equivalent to Log() followed by FailNow() .
271
+ // Fatal is equivalent to Log followed by FailNow.
268
272
func (c * common ) Fatal (args ... interface {}) {
269
273
c .log (fmt .Sprintln (args ... ))
270
274
c .FailNow ()
271
275
}
272
276
273
- // Fatalf is equivalent to Logf() followed by FailNow() .
277
+ // Fatalf is equivalent to Logf followed by FailNow.
274
278
func (c * common ) Fatalf (format string , args ... interface {}) {
275
279
c .log (fmt .Sprintf (format , args ... ))
276
280
c .FailNow ()
@@ -345,20 +349,23 @@ func (t *T) report() {
345
349
}
346
350
}
347
351
348
- // Skip is equivalent to Log() followed by SkipNow() .
352
+ // Skip is equivalent to Log followed by SkipNow.
349
353
func (t * T ) Skip (args ... interface {}) {
350
354
t .log (fmt .Sprintln (args ... ))
351
355
t .SkipNow ()
352
356
}
353
357
354
- // Skipf is equivalent to Logf() followed by SkipNow() .
358
+ // Skipf is equivalent to Logf followed by SkipNow.
355
359
func (t * T ) Skipf (format string , args ... interface {}) {
356
360
t .log (fmt .Sprintf (format , args ... ))
357
361
t .SkipNow ()
358
362
}
359
363
360
- // SkipNow marks the function as having been skipped and stops its execution.
361
- // Execution will continue at the next test or benchmark. See also, t.FailNow.
364
+ // SkipNow marks the test as having been skipped and stops its execution.
365
+ // Execution will continue at the next test or benchmark. See also FailNow.
366
+ // SkipNow must be called from the goroutine running the test, not from
367
+ // other goroutines created during the test. Calling SkipNow does not stop
368
+ // those other goroutines.
362
369
func (t * T ) SkipNow () {
363
370
t .skip ()
364
371
runtime .Goexit ()
@@ -370,7 +377,7 @@ func (t *T) skip() {
370
377
t .skipped = true
371
378
}
372
379
373
- // Skipped reports whether the function was skipped.
380
+ // Skipped reports whether the test was skipped.
374
381
func (t * T ) Skipped () bool {
375
382
t .mu .RLock ()
376
383
defer t .mu .RUnlock ()
0 commit comments