mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
fix: fix skip
This commit is contained in:
parent
edd30c88db
commit
ecbcd7780e
@ -1,7 +1,14 @@
|
|||||||
package keelrequire
|
package keelrequire
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/foomo/keel/log"
|
||||||
|
keeltestutil "github.com/foomo/keel/test/util"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/tidwall/pretty"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Assertions provides assertion methods around the
|
// Assertions provides assertion methods around the
|
||||||
@ -19,10 +26,19 @@ func New(t *testing.T) *Assertions { //nolint:thelper
|
|||||||
|
|
||||||
func (a *Assertions) InlineEqual(actual interface{}, msgAndArgs ...interface{}) {
|
func (a *Assertions) InlineEqual(actual interface{}, msgAndArgs ...interface{}) {
|
||||||
a.t.Helper()
|
a.t.Helper()
|
||||||
InlineEqual(a.t, actual, msgAndArgs...)
|
if expected, ok := keeltestutil.Inline(a.t, 2, "%v", actual); ok {
|
||||||
|
require.Equal(a.t, expected, fmt.Sprintf("%v", actual), msgAndArgs...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Assertions) InlineJSONEq(actual interface{}, msgAndArgs ...interface{}) {
|
func (a *Assertions) InlineJSONEq(actual interface{}, msgAndArgs ...interface{}) {
|
||||||
a.t.Helper()
|
a.t.Helper()
|
||||||
InlineJSONEq(a.t, actual, msgAndArgs...)
|
// marshal value
|
||||||
|
actualBytes, err := json.Marshal(actual)
|
||||||
|
if err != nil {
|
||||||
|
a.t.Fatal("failed to marshal json", log.FError(err))
|
||||||
|
}
|
||||||
|
if expected, ok := keeltestutil.Inline(a.t, 2, string(actualBytes)); ok {
|
||||||
|
require.Equal(a.t, string(pretty.Pretty([]byte(expected))), string(pretty.Pretty(actualBytes)), msgAndArgs...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,9 +13,6 @@ import (
|
|||||||
|
|
||||||
func InlineEqual(t *testing.T, actual interface{}, msgAndArgs ...interface{}) {
|
func InlineEqual(t *testing.T, actual interface{}, msgAndArgs ...interface{}) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if t.Failed() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if expected, ok := keeltestutil.Inline(t, 2, "%v", actual); ok {
|
if expected, ok := keeltestutil.Inline(t, 2, "%v", actual); ok {
|
||||||
require.Equal(t, expected, fmt.Sprintf("%v", actual), msgAndArgs...)
|
require.Equal(t, expected, fmt.Sprintf("%v", actual), msgAndArgs...)
|
||||||
}
|
}
|
||||||
@ -23,9 +20,6 @@ func InlineEqual(t *testing.T, actual interface{}, msgAndArgs ...interface{}) {
|
|||||||
|
|
||||||
func InlineJSONEq(t *testing.T, actual interface{}, msgAndArgs ...interface{}) {
|
func InlineJSONEq(t *testing.T, actual interface{}, msgAndArgs ...interface{}) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if t.Failed() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// marshal value
|
// marshal value
|
||||||
actualBytes, err := json.Marshal(actual)
|
actualBytes, err := json.Marshal(actual)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user