diff --git a/VERSION b/VERSION index 50f402a..85ab4c6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.49 +0.0.50 diff --git a/mock/matcher.go b/mock/matcher.go index 156e853..65f0dc2 100644 --- a/mock/matcher.go +++ b/mock/matcher.go @@ -26,7 +26,7 @@ const ( // a diff. The default, 3, means no context lines. func Context(context int) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.Context(context) + mocks.diff.Context(context) } } @@ -34,7 +34,7 @@ func Context(context int) ConfigFunc { // `Want`. func FromFile(file string) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.FromFile(file) + mocks.diff.FromFile(file) } } @@ -42,7 +42,7 @@ func FromFile(file string) ConfigFunc { // empty. func FromDate(date string) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.FromDate(date) + mocks.diff.FromDate(date) } } @@ -50,7 +50,7 @@ func FromDate(date string) ConfigFunc { // `Got`. func ToFile(file string) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.ToFile(file) + mocks.diff.ToFile(file) } } @@ -58,7 +58,7 @@ func ToFile(file string) ConfigFunc { // empty. func ToDate(date string) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.ToDate(date) + mocks.diff.ToDate(date) } } @@ -68,7 +68,7 @@ func ToDate(date string) ConfigFunc { // with `\t` or perhaps two spaces with ` `. func Indent(indent string) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.Indent(indent) + mocks.diff.Indent(indent) } } @@ -78,7 +78,7 @@ func Indent(indent string) ConfigFunc { // specifically want to limit deeply nested structures. func MaxDepth(maxDepth int) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.MaxDepth(maxDepth) + mocks.diff.MaxDepth(maxDepth) } } @@ -87,7 +87,7 @@ func MaxDepth(maxDepth int) ConfigFunc { // methods will not be invoked. func DisableMethods(disable bool) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.DisableMethods(disable) + mocks.diff.DisableMethods(disable) } } @@ -104,7 +104,7 @@ func DisableMethods(disable bool) ConfigFunc { // or with the "safe" build tag specified. func DisablePointerMethods(disable bool) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.DisablePointerMethods(disable) + mocks.diff.DisablePointerMethods(disable) } } @@ -112,7 +112,7 @@ func DisablePointerMethods(disable bool) ConfigFunc { // addresses. This is useful when diffing data structures in tests. func DisablePointerAddresses(disable bool) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.DisablePointerAddresses(disable) + mocks.diff.DisablePointerAddresses(disable) } } @@ -121,7 +121,7 @@ func DisablePointerAddresses(disable bool) ConfigFunc { // structures in tests. func DisableCapacities(disable bool) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.DisableCapacities(disable) + mocks.diff.DisableCapacities(disable) } } @@ -135,7 +135,7 @@ func DisableCapacities(disable bool) ConfigFunc { // via the DisableMethods or DisablePointerMethods options. func ContinueOnMethod(enable bool) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.ContinueOnMethod(enable) + mocks.diff.ContinueOnMethod(enable) } } @@ -147,7 +147,7 @@ func ContinueOnMethod(enable bool) ConfigFunc { // guarantees display stability. func SortKeys(sort bool) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.SortKeys(sort) + mocks.diff.SortKeys(sort) } } @@ -156,7 +156,7 @@ func SortKeys(sort bool) ConfigFunc { // sorted (see `SortKeys`). func SpewKeys(spew bool) ConfigFunc { return func(mocks *Mocks) { - mocks.matcher.SpewKeys(spew) + mocks.diff.SpewKeys(spew) } } @@ -382,7 +382,7 @@ type Equal struct { // is a mismatch in the expected and actual values. func (mocks *Mocks) Equal(want any) *Equal { return &Equal{ - config: mocks.matcher, + config: mocks.diff, want: want, diff: "", } diff --git a/mock/matcher_test.go b/mock/matcher_test.go index 04e2f43..e178afa 100644 --- a/mock/matcher_test.go +++ b/mock/matcher_test.go @@ -15,10 +15,10 @@ import ( ) const ( + nameDiff = "diff" nameDlib = "dlib" nameSpew = "spew" nameSpewTime = "spewTime" - nameMatcher = "matcher" ) // diff creates the complete expected diff output in unified diff format. It @@ -34,7 +34,7 @@ func GetDiffConfigAccessor( mocks *mock.Mocks, ) reflect.Builder[*mock.DiffConfig] { return reflect.NewAccessor(reflect.NewAccessor(mocks). - Get(nameMatcher).(*mock.DiffConfig)) + Get(nameDiff).(*mock.DiffConfig)) } type DiffParams struct { @@ -454,7 +454,7 @@ var configTestCases = map[string]ConfigParams{ }, } -func TestMatcherConfig(t *testing.T) { +func TestConfig(t *testing.T) { test.Map(t, configTestCases). Run(func(t test.Test, param ConfigParams) { // Given diff --git a/mock/mocks.go b/mock/mocks.go index 3a4db94..7acc527 100644 --- a/mock/mocks.go +++ b/mock/mocks.go @@ -83,19 +83,19 @@ type Mocks struct { // A map of mock key value pairs. args map[any]any - // Internal matcher settings. - matcher *DiffConfig + // Internal diff settings. + diff *DiffConfig } // NewMocks creates a new mock handler using given test reporter, e.g. // [*testing.T], or [test.Test]. func NewMocks(t gomock.TestReporter, fncalls ...ConfigFunc) *Mocks { return (&Mocks{ - Ctrl: gomock.NewController(t), - wg: sync.NewLenientWaitGroup(), - mocks: map[reflect.Value]any{}, - args: map[any]any{}, - matcher: NewDiffConfig(), + Ctrl: gomock.NewController(t), + wg: sync.NewLenientWaitGroup(), + mocks: map[reflect.Value]any{}, + args: map[any]any{}, + diff: NewDiffConfig(), }).Config(fncalls...).syncWith(t) }