chore(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0 #16

Merged
argoyle merged 2 commits from dependabot-go_modules-github.com-stretchr-testify-1.8.0 into master 2022-06-30 06:31:12 +00:00
Showing only changes of commit 7642d7e9c1 - Show all commits
+9 -1
View File
@@ -21,6 +21,7 @@ package apex
import (
"fmt"
"regexp"
"sync"
"testing"
@@ -50,7 +51,7 @@ func TestMock_Check(t *testing.T) {
name: "different",
fields: fields{Logged: []string{"same"}},
args: args{wantLogged: []string{"different"}},
want: []string{"\n\tError Trace:\tmocks.go:67\n\t \t\t\t\tmocks_test.go:63\n\tError: \tNot equal: \n\t \texpected: []string{\"different\"}\n\t \tactual : []string{\"same\"}\n\t \t\n\t \tDiff:\n\t \t--- Expected\n\t \t+++ Actual\n\t \t@@ -1,3 +1,3 @@\n\t \t ([]string) (len=1) {\n\t \t- (string) (len=9) \"different\"\n\t \t+ (string) (len=4) \"same\"\n\t \t }\n\tTest: \t\n"},
want: []string{"\n\tError: \tNot equal: \n\t \texpected: []string{\"different\"}\n\t \tactual : []string{\"same\"}\n\t \t\n\t \tDiff:\n\t \t--- Expected\n\t \t+++ Actual\n\t \t@@ -1,3 +1,3 @@\n\t \t ([]string) (len=1) {\n\t \t- (string) (len=9) \"different\"\n\t \t+ (string) (len=4) \"same\"\n\t \t }\n\tTest: \t\n"},
},
}
for _, tt := range tests {
@@ -78,5 +79,12 @@ type MockT struct {
}
func (m *MockT) Errorf(format string, args ...interface{}) {
re, err := regexp.Compile(`(?s)^\tError Trace:.*(\tError:.*)$`)
assert.NoError(m, err)
for i, a := range args {
if s, ok := a.(string); ok {
args[i] = re.ReplaceAllString(s, "$1")
}
}
m.errors = append(m.errors, fmt.Sprintf(format, args...))
}