terraform/vendor/github.com/henrikhodne/go-librato/librato/testing_helpers.go

18 lines
335 B
Go
Raw Normal View History

2015-10-01 00:08:51 +02:00
package librato
import (
"fmt"
"path/filepath"
"runtime"
"testing"
)
// ok fails the test if an err is not nil.
func ok(tb testing.TB, err error) {
if err != nil {
_, file, line, _ := runtime.Caller(1)
fmt.Printf("\033[31m%s:%d: unexpected error: %s\033[39m\n\n", filepath.Base(file), line, err.Error())
tb.FailNow()
}
}