You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
620 B

  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build !go1.7
  5. package testtext
  6. import "testing"
  7. func Run(t *testing.T, name string, fn func(t *testing.T)) bool {
  8. t.Logf("Running %s...", name)
  9. fn(t)
  10. return t.Failed()
  11. }
  12. // Bench runs the given benchmark function. This pre-1.7 implementation renders
  13. // the measurement useless, but allows the code to be compiled at least.
  14. func Bench(b *testing.B, name string, fn func(b *testing.B)) bool {
  15. b.Logf("Running %s...", name)
  16. fn(b)
  17. return b.Failed()
  18. }