18 lines
335 B
Go
18 lines
335 B
Go
|
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()
|
||
|
}
|
||
|
}
|