* added TestCompletionStream test moved completion stream testing to seperate function added NoErrorF fixes nil pointer reference on stream object * update integration test models
56 lines
962 B
Go
56 lines
962 B
Go
package checks
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func NoError(t *testing.T, err error, message ...string) {
|
|
t.Helper()
|
|
if err != nil {
|
|
t.Error(err, message)
|
|
}
|
|
}
|
|
|
|
func NoErrorF(t *testing.T, err error, message ...string) {
|
|
t.Helper()
|
|
if err != nil {
|
|
t.Fatal(err, message)
|
|
}
|
|
}
|
|
|
|
func HasError(t *testing.T, err error, message ...string) {
|
|
t.Helper()
|
|
if err == nil {
|
|
t.Error(err, message)
|
|
}
|
|
}
|
|
|
|
func ErrorIs(t *testing.T, err, target error, msg ...string) {
|
|
t.Helper()
|
|
if !errors.Is(err, target) {
|
|
t.Fatal(msg)
|
|
}
|
|
}
|
|
|
|
func ErrorIsF(t *testing.T, err, target error, format string, msg ...string) {
|
|
t.Helper()
|
|
if !errors.Is(err, target) {
|
|
t.Fatalf(format, msg)
|
|
}
|
|
}
|
|
|
|
func ErrorIsNot(t *testing.T, err, target error, msg ...string) {
|
|
t.Helper()
|
|
if errors.Is(err, target) {
|
|
t.Fatal(msg)
|
|
}
|
|
}
|
|
|
|
func ErrorIsNotf(t *testing.T, err, target error, format string, msg ...string) {
|
|
t.Helper()
|
|
if errors.Is(err, target) {
|
|
t.Fatalf(format, msg)
|
|
}
|
|
}
|