Skip to content

Commit

Permalink
stop using assert extensions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrre committed Oct 18, 2023
1 parent 30fbe9c commit f3bdb5f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 38 deletions.
16 changes: 0 additions & 16 deletions compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,9 @@ import (

"github.com/pierrre/assert"
"github.com/pierrre/assert/assertauto"
"github.com/pierrre/assert/ext/pierrreerrors"
"github.com/pierrre/assert/ext/pierrrepretty"
. "github.com/pierrre/compare"
)

func init() {
// Prevent import cycle.
assert.DeepEqualer = func(v1, v2 any) (diff string, equal bool) {
res := Compare(v1, v2)
if len(res) == 0 {
return "", true
}
diff = fmt.Sprintf("%+v", res)
return diff, false
}
pierrrepretty.ConfigureDefault()
pierrreerrors.Configure()
}

func ExampleCompare() {
type T struct {
String string
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ require (
github.com/pierrre/go-libs v0.2.13
)

require (
github.com/pierrre/errors v0.5.1 // indirect
github.com/pierrre/pretty v0.0.10 // indirect
)
require github.com/pierrre/pretty v0.0.10 // indirect
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
github.com/pierrre/assert v0.3.0 h1:uJMuvuJC9oJaZDgnJELJRkbQi+7VCXIva+m7WYipw2k=
github.com/pierrre/assert v0.3.0/go.mod h1:IpY8ao9wBlIxR/xeBTrvWKGd61L5iCdidguQXbTaclo=
github.com/pierrre/errors v0.5.1 h1:bv/kUIJfFR6oCWmMJumXU6+x750TZ17ukUEplpnAe3A=
github.com/pierrre/errors v0.5.1/go.mod h1:qrmBgXriffc/jS+Jw9R32XEKWddKc9NM0Foaoqxlths=
github.com/pierrre/go-libs v0.2.13 h1:8/Rzu43Qcyd+hfg6qmOGD5+ey/Us3xgXkrXQ/FJGHTU=
github.com/pierrre/go-libs v0.2.13/go.mod h1:flMFC0Y9zAMRsVkXJMUkTSzcNJQWWmeC6D0aQkRfEZc=
github.com/pierrre/pretty v0.0.10 h1:Cb5som+1EpU+x7UA5AMy9I8AY2XkzMBywkLEAdo1JDg=
Expand Down
16 changes: 0 additions & 16 deletions internal/internal_test.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
package internal_test

import (
"fmt"
"net"
"reflect"
"testing"

"github.com/pierrre/assert"
"github.com/pierrre/assert/ext/pierrrepretty"
"github.com/pierrre/compare"
. "github.com/pierrre/compare/internal"
)

func init() {
// Prevent import cycle.
assert.DeepEqualer = func(v1, v2 any) (diff string, equal bool) {
res := compare.Compare(v1, v2)
if len(res) == 0 {
return "", true
}
diff = fmt.Sprintf("%+v", res)
return diff, false
}
pierrrepretty.ConfigureDefault()
}

var sortMapsKeysTestCases = []struct {
name string
values []reflect.Value
Expand Down

0 comments on commit f3bdb5f

Please sign in to comment.