From a98f7420ad181d67f3b206ba37ab120bbb2136cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jul 2023 08:32:22 +0000 Subject: [PATCH] Bump github.com/smartystreets/goconvey from 1.8.0 to 1.8.1 Bumps [github.com/smartystreets/goconvey](https://github.com/smartystreets/goconvey) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/smartystreets/goconvey/releases) - [Commits](https://github.com/smartystreets/goconvey/compare/v1.8.0...v1.8.1) --- updated-dependencies: - dependency-name: github.com/smartystreets/goconvey dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 4 +- go.sum | 8 +- .../assertions/.gitignore | 0 .../assertions/.travis.yml | 0 .../assertions/CONTRIBUTING.md | 6 +- .../assertions/LICENSE.md | 0 .../assertions/Makefile | 0 vendor/github.com/smarty/assertions/README.md | 6 + .../assertions/collections.go | 2 +- .../assertions/doc.go | 6 +- .../smarty/assertions/equal_method.go | 65 ++++++++++ .../assertions/equality.go | 77 ++++-------- .../assertions/equality_diff.go | 2 +- .../smarty/assertions/equality_specs.go | 119 ++++++++++++++++++ .../assertions/filter.go | 0 .../assertions/internal/go-diff/AUTHORS | 0 .../assertions/internal/go-diff/CONTRIBUTORS | 0 .../assertions/internal/go-diff/LICENSE | 0 .../internal/go-diff/diffmatchpatch/diff.go | 0 .../go-diff/diffmatchpatch/diffmatchpatch.go | 0 .../internal/go-diff/diffmatchpatch/match.go | 0 .../go-diff/diffmatchpatch/mathutil.go | 0 .../diffmatchpatch/operation_string.go | 0 .../internal/go-diff/diffmatchpatch/patch.go | 0 .../go-diff/diffmatchpatch/stringutil.go | 0 .../assertions/internal/go-render/LICENSE | 0 .../internal/go-render/render/render.go | 0 .../internal/go-render/render/render_time.go | 0 .../internal/oglematchers/.gitignore | 0 .../internal/oglematchers/.travis.yml | 0 .../assertions/internal/oglematchers/LICENSE | 0 .../internal/oglematchers/README.md | 12 +- .../internal/oglematchers/any_of.go | 0 .../internal/oglematchers/contains.go | 0 .../internal/oglematchers/deep_equals.go | 0 .../internal/oglematchers/equals.go | 0 .../internal/oglematchers/greater_or_equal.go | 0 .../internal/oglematchers/greater_than.go | 0 .../internal/oglematchers/less_or_equal.go | 0 .../internal/oglematchers/less_than.go | 0 .../internal/oglematchers/matcher.go | 4 +- .../assertions/internal/oglematchers/not.go | 0 .../oglematchers/transform_description.go | 0 .../assertions/messages.go | 4 +- .../assertions/panic.go | 0 .../assertions/quantity.go | 2 +- .../assertions/serializer.go | 4 +- .../assertions/strings.go | 0 .../assertions/time.go | 0 .../assertions/type.go | 0 .../smartystreets/assertions/README.md | 6 - .../smartystreets/assertions/equal_method.go | 75 ----------- .../goconvey/convey/assertions.go | 4 +- .../smartystreets/goconvey/convey/init.go | 2 +- .../goconvey/convey/reporting/reports.go | 2 +- .../goconvey/convey/update_assertions.sh | 8 +- vendor/modules.txt | 12 +- 57 files changed, 254 insertions(+), 176 deletions(-) rename vendor/github.com/{smartystreets => smarty}/assertions/.gitignore (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/.travis.yml (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/CONTRIBUTING.md (60%) rename vendor/github.com/{smartystreets => smarty}/assertions/LICENSE.md (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/Makefile (100%) create mode 100644 vendor/github.com/smarty/assertions/README.md rename vendor/github.com/{smartystreets => smarty}/assertions/collections.go (99%) rename vendor/github.com/{smartystreets => smarty}/assertions/doc.go (95%) create mode 100644 vendor/github.com/smarty/assertions/equal_method.go rename vendor/github.com/{smartystreets => smarty}/assertions/equality.go (77%) rename vendor/github.com/{smartystreets => smarty}/assertions/equality_diff.go (93%) create mode 100644 vendor/github.com/smarty/assertions/equality_specs.go rename vendor/github.com/{smartystreets => smarty}/assertions/filter.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/AUTHORS (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/CONTRIBUTORS (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/LICENSE (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/diffmatchpatch/diff.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/diffmatchpatch/match.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/diffmatchpatch/mathutil.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/diffmatchpatch/operation_string.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/diffmatchpatch/patch.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-diff/diffmatchpatch/stringutil.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-render/LICENSE (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-render/render/render.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/go-render/render/render_time.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/.gitignore (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/.travis.yml (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/LICENSE (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/README.md (72%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/any_of.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/contains.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/deep_equals.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/equals.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/greater_or_equal.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/greater_than.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/less_or_equal.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/less_than.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/matcher.go (94%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/not.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/internal/oglematchers/transform_description.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/messages.go (96%) rename vendor/github.com/{smartystreets => smarty}/assertions/panic.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/quantity.go (98%) rename vendor/github.com/{smartystreets => smarty}/assertions/serializer.go (92%) rename vendor/github.com/{smartystreets => smarty}/assertions/strings.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/time.go (100%) rename vendor/github.com/{smartystreets => smarty}/assertions/type.go (100%) delete mode 100644 vendor/github.com/smartystreets/assertions/README.md delete mode 100644 vendor/github.com/smartystreets/assertions/equal_method.go diff --git a/go.mod b/go.mod index 0936a04..94a6b61 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,13 @@ go 1.18 require ( github.com/google/gopacket v1.1.19 - github.com/smartystreets/goconvey v1.8.0 + github.com/smartystreets/goconvey v1.8.1 ) require ( github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect - github.com/smartystreets/assertions v1.13.1 // indirect + github.com/smarty/assertions v1.15.0 // indirect golang.org/x/net v0.9.0 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/go.sum b/go.sum index b9fb0b7..fb1d9b7 100644 --- a/go.sum +++ b/go.sum @@ -4,10 +4,10 @@ github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25d github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/smartystreets/assertions v1.13.1 h1:Ef7KhSmjZcK6AVf9YbJdvPYG9avaF0ZxudX+ThRdWfU= -github.com/smartystreets/assertions v1.13.1/go.mod h1:cXr/IwVfSo/RbCSPhoAPv73p3hlSdrBH/b3SdnW/LMY= -github.com/smartystreets/goconvey v1.8.0 h1:Oi49ha/2MURE0WexF052Z0m+BNSGirfjg5RL+JXWq3w= -github.com/smartystreets/goconvey v1.8.0/go.mod h1:EdX8jtrTIj26jmjCOVNMVSIYAtgexqXKHOXW2Dx9JLg= +github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY= +github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec= +github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY= +github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= diff --git a/vendor/github.com/smartystreets/assertions/.gitignore b/vendor/github.com/smarty/assertions/.gitignore similarity index 100% rename from vendor/github.com/smartystreets/assertions/.gitignore rename to vendor/github.com/smarty/assertions/.gitignore diff --git a/vendor/github.com/smartystreets/assertions/.travis.yml b/vendor/github.com/smarty/assertions/.travis.yml similarity index 100% rename from vendor/github.com/smartystreets/assertions/.travis.yml rename to vendor/github.com/smarty/assertions/.travis.yml diff --git a/vendor/github.com/smartystreets/assertions/CONTRIBUTING.md b/vendor/github.com/smarty/assertions/CONTRIBUTING.md similarity index 60% rename from vendor/github.com/smartystreets/assertions/CONTRIBUTING.md rename to vendor/github.com/smarty/assertions/CONTRIBUTING.md index 1820ecb..a8c4823 100644 --- a/vendor/github.com/smartystreets/assertions/CONTRIBUTING.md +++ b/vendor/github.com/smarty/assertions/CONTRIBUTING.md @@ -1,11 +1,11 @@ # Contributing -In general, the code posted to the [SmartyStreets github organization](https://github.com/smartystreets) is created to solve specific problems at SmartyStreets that are ancillary to our core products in the address verification industry and may or may not be useful to other organizations or developers. Our reason for posting said code isn't necessarily to solicit feedback or contributions from the community but more as a showcase of some of the approaches to solving problems we have adopted. +In general, the code posted to the [Smarty github organization](https://github.com/smarty) is created to solve specific problems at Smarty that are ancillary to our core products in the address verification industry and may or may not be useful to other organizations or developers. Our reason for posting said code isn't necessarily to solicit feedback or contributions from the community but more as a showcase of some of the approaches to solving problems we have adopted. Having stated that, we do consider issues raised by other githubbers as well as contributions submitted via pull requests. When submitting such a pull request, please follow these guidelines: -- _Look before you leap:_ If the changes you plan to make are significant, it's in everyone's best interest for you to discuss them with a SmartyStreets team member prior to opening a pull request. -- _License and ownership:_ If modifying the `LICENSE.md` file, limit your changes to fixing typographical mistakes. Do NOT modify the actual terms in the license or the copyright by **SmartyStreets, LLC**. Code submitted to SmartyStreets projects becomes property of SmartyStreets and must be compatible with the associated license. +- _Look before you leap:_ If the changes you plan to make are significant, it's in everyone's best interest for you to discuss them with a Smarty team member prior to opening a pull request. +- _License and ownership:_ If modifying the `LICENSE.md` file, limit your changes to fixing typographical mistakes. Do NOT modify the actual terms in the license or the copyright by **Smarty, LLC**. Code submitted to Smarty projects becomes property of Smarty and must be compatible with the associated license. - _Testing:_ If the code you are submitting resides in packages/modules covered by automated tests, be sure to add passing tests that cover your changes and assert expected behavior and state. Submit the additional test cases as part of your change set. - _Style:_ Match your approach to **naming** and **formatting** with the surrounding code. Basically, the code you submit shouldn't stand out. - "Naming" refers to such constructs as variables, methods, functions, classes, structs, interfaces, packages, modules, directories, files, etc... diff --git a/vendor/github.com/smartystreets/assertions/LICENSE.md b/vendor/github.com/smarty/assertions/LICENSE.md similarity index 100% rename from vendor/github.com/smartystreets/assertions/LICENSE.md rename to vendor/github.com/smarty/assertions/LICENSE.md diff --git a/vendor/github.com/smartystreets/assertions/Makefile b/vendor/github.com/smarty/assertions/Makefile similarity index 100% rename from vendor/github.com/smartystreets/assertions/Makefile rename to vendor/github.com/smarty/assertions/Makefile diff --git a/vendor/github.com/smarty/assertions/README.md b/vendor/github.com/smarty/assertions/README.md new file mode 100644 index 0000000..3275420 --- /dev/null +++ b/vendor/github.com/smarty/assertions/README.md @@ -0,0 +1,6 @@ +#### SMARTY DISCLAIMER: Subject to the terms of the associated license agreement, this software is freely available for your use. This software is FREE, AS IN PUPPIES, and is a gift. Enjoy your new responsibility. This means that while we may consider enhancement requests, we may or may not choose to entertain requests at our sole and absolute discretion. + +[![Build Status](https://travis-ci.org/smarty/assertions.svg?branch=master)](https://travis-ci.org/smarty/assertions) +[![Code Coverage](https://codecov.io/gh/smarty/assertions/branch/master/graph/badge.svg)](https://codecov.io/gh/smarty/assertions) +[![Go Report Card](https://goreportcard.com/badge/github.com/smarty/assertions)](https://goreportcard.com/report/github.com/smarty/assertions) +[![GoDoc](https://godoc.org/github.com/smarty/assertions?status.svg)](http://godoc.org/github.com/smarty/assertions) diff --git a/vendor/github.com/smartystreets/assertions/collections.go b/vendor/github.com/smarty/assertions/collections.go similarity index 99% rename from vendor/github.com/smartystreets/assertions/collections.go rename to vendor/github.com/smarty/assertions/collections.go index b7648c7..6444a63 100644 --- a/vendor/github.com/smartystreets/assertions/collections.go +++ b/vendor/github.com/smarty/assertions/collections.go @@ -4,7 +4,7 @@ import ( "fmt" "reflect" - "github.com/smartystreets/assertions/internal/oglematchers" + "github.com/smarty/assertions/internal/oglematchers" ) // ShouldContain receives exactly two parameters. The first is a slice and the diff --git a/vendor/github.com/smartystreets/assertions/doc.go b/vendor/github.com/smarty/assertions/doc.go similarity index 95% rename from vendor/github.com/smartystreets/assertions/doc.go rename to vendor/github.com/smarty/assertions/doc.go index 1629eef..e872d4a 100644 --- a/vendor/github.com/smartystreets/assertions/doc.go +++ b/vendor/github.com/smarty/assertions/doc.go @@ -1,11 +1,11 @@ // Package assertions contains the implementations for all assertions which // are referenced in goconvey's `convey` package -// (github.com/smartystreets/goconvey/convey) and gunit (github.com/smartystreets/gunit) +// (github.com/smarty/goconvey/convey) and gunit (github.com/smarty/gunit) // for use with the So(...) method. // They can also be used in traditional Go test functions and even in // applications. // -// https://smartystreets.com +// https://smarty.com // // Many of the assertions lean heavily on work done by Aaron Jacobs in his excellent oglematchers library. // (https://github.com/jacobsa/oglematchers) @@ -85,7 +85,7 @@ func (this *Assertion) So(actual any, assert SoFunc, expected ...any) bool { // } // // For an alternative implementation of So (that provides more flexible return options) -// see the `So` function in the package at github.com/smartystreets/assertions/assert. +// see the `So` function in the package at github.com/smarty/assertions/assert. func So(actual any, assert SoFunc, expected ...any) (bool, string) { if result := so(actual, assert, expected...); len(result) == 0 { return true, result diff --git a/vendor/github.com/smarty/assertions/equal_method.go b/vendor/github.com/smarty/assertions/equal_method.go new file mode 100644 index 0000000..a9088c5 --- /dev/null +++ b/vendor/github.com/smarty/assertions/equal_method.go @@ -0,0 +1,65 @@ +package assertions + +import "reflect" + +type equalityMethodSpecification struct{} + +func (this equalityMethodSpecification) assertable(a, b any) bool { + if !bothAreSameType(a, b) { + return false + } + if !typeHasEqualMethod(a) { + return false + } + if !equalMethodReceivesSameTypeForComparison(a) { + return false + } + if !equalMethodReturnsBool(a) { + return false + } + return true +} +func bothAreSameType(a, b any) bool { + aType := reflect.TypeOf(a) + if aType == nil { + return false + } + if aType.Kind() == reflect.Ptr { + aType = aType.Elem() + } + bType := reflect.TypeOf(b) + return aType == bType +} +func typeHasEqualMethod(a any) bool { + aInstance := reflect.ValueOf(a) + equalMethod := aInstance.MethodByName("Equal") + return equalMethod != reflect.Value{} +} +func equalMethodReceivesSameTypeForComparison(a any) bool { + aType := reflect.TypeOf(a) + if aType.Kind() == reflect.Ptr { + aType = aType.Elem() + } + aInstance := reflect.ValueOf(a) + equalMethod := aInstance.MethodByName("Equal") + signature := equalMethod.Type() + return signature.NumIn() == 1 && signature.In(0) == aType +} +func equalMethodReturnsBool(a any) bool { + aInstance := reflect.ValueOf(a) + equalMethod := aInstance.MethodByName("Equal") + signature := equalMethod.Type() + return signature.NumOut() == 1 && signature.Out(0) == reflect.TypeOf(true) +} + +func (this equalityMethodSpecification) passes(A, B any) bool { + a := reflect.ValueOf(A) + b := reflect.ValueOf(B) + return areEqual(a, b) && areEqual(b, a) +} +func areEqual(receiver reflect.Value, argument reflect.Value) bool { + equalMethod := receiver.MethodByName("Equal") + argumentList := []reflect.Value{argument} + result := equalMethod.Call(argumentList) + return result[0].Bool() +} diff --git a/vendor/github.com/smartystreets/assertions/equality.go b/vendor/github.com/smarty/assertions/equality.go similarity index 77% rename from vendor/github.com/smartystreets/assertions/equality.go rename to vendor/github.com/smarty/assertions/equality.go index 8497dee..090f0b2 100644 --- a/vendor/github.com/smartystreets/assertions/equality.go +++ b/vendor/github.com/smarty/assertions/equality.go @@ -8,49 +8,38 @@ import ( "reflect" "strings" - "github.com/smartystreets/assertions/internal/go-render/render" - "github.com/smartystreets/assertions/internal/oglematchers" + "github.com/smarty/assertions/internal/go-render/render" ) // ShouldEqual receives exactly two parameters and does an equality check // using the following semantics: -// 1. If the expected and actual values implement an Equal method in the form -// `func (this T) Equal(that T) bool` then call the method. If true, they are equal. -// 2. The expected and actual values are judged equal or not by oglematchers.Equals. +// It uses reflect.DeepEqual in most cases, but also compares numerics +// regardless of specific type and compares time.Time values using the +// time.Equal method. func ShouldEqual(actual any, expected ...any) string { if message := need(1, expected); message != success { return message } return shouldEqual(actual, expected[0]) } -func shouldEqual(actual, expected any) (message string) { - defer func() { - if r := recover(); r != nil { - message = serializer.serialize(expected, actual, composeEqualityMismatchMessage(expected, actual)) +func shouldEqual(actual, expected any) string { + for _, spec := range equalitySpecs { + if !spec.assertable(actual, expected) { + continue } - }() - - if spec := newEqualityMethodSpecification(expected, actual); spec.IsSatisfied() && spec.AreEqual() { - return success - } else if matchError := oglematchers.Equals(expected).Matches(actual); matchError == nil { - return success + if spec.passes(actual, expected) { + return success + } + break } - - return serializer.serialize(expected, actual, composeEqualityMismatchMessage(expected, actual)) -} -func composeEqualityMismatchMessage(expected, actual any) string { - var ( - renderedExpected = fmt.Sprintf("%v", expected) - renderedActual = fmt.Sprintf("%v", actual) - ) - - if renderedExpected != renderedActual { - return fmt.Sprintf(shouldHaveBeenEqual+composePrettyDiff(renderedExpected, renderedActual), expected, actual) - } else if reflect.TypeOf(expected) != reflect.TypeOf(actual) { - return fmt.Sprintf(shouldHaveBeenEqualTypeMismatch, expected, expected, actual, actual) - } else { - return fmt.Sprintf(shouldHaveBeenEqualNoResemblance, renderedExpected) + renderedExpected, renderedActual := render.Render(expected), render.Render(actual) + if renderedActual == renderedExpected { + message := fmt.Sprintf(shouldHaveResembledButTypeDiff, renderedExpected, renderedActual) + return serializer.serializeDetailed(expected, actual, message) } + message := fmt.Sprintf(shouldHaveResembled, renderedExpected, renderedActual) + + composePrettyDiff(renderedExpected, renderedActual) + return serializer.serializeDetailed(expected, actual, message) } // ShouldNotEqual receives exactly two parameters and does an inequality check. @@ -179,34 +168,14 @@ func remarshal(value string) (string, error) { return string(canonical), nil } -// ShouldResemble receives exactly two parameters and does a deep equal check (see reflect.DeepEqual) +// ShouldResemble is an alias for ShouldEqual. func ShouldResemble(actual any, expected ...any) string { - if message := need(1, expected); message != success { - return message - } - - if matchError := oglematchers.DeepEquals(expected[0]).Matches(actual); matchError != nil { - renderedExpected, renderedActual := render.Render(expected[0]), render.Render(actual) - if renderedActual == renderedExpected { - message := fmt.Sprintf(shouldHaveResembledButTypeDiff, renderedExpected, renderedActual) - return serializer.serializeDetailed(expected[0], actual, message) - } - message := fmt.Sprintf(shouldHaveResembled, renderedExpected, renderedActual) + - composePrettyDiff(renderedExpected, renderedActual) - return serializer.serializeDetailed(expected[0], actual, message) - } - - return success + return ShouldEqual(actual, expected...) } -// ShouldNotResemble receives exactly two parameters and does an inverse deep equal check (see reflect.DeepEqual) +// ShouldNotResemble is an alias for ShouldNotEqual. func ShouldNotResemble(actual any, expected ...any) string { - if message := need(1, expected); message != success { - return message - } else if ShouldResemble(actual, expected[0]) == success { - return fmt.Sprintf(shouldNotHaveResembled, render.Render(actual), render.Render(expected[0])) - } - return success + return ShouldNotEqual(actual, expected...) } // ShouldPointTo receives exactly two parameters and checks to see that they point to the same address. diff --git a/vendor/github.com/smartystreets/assertions/equality_diff.go b/vendor/github.com/smarty/assertions/equality_diff.go similarity index 93% rename from vendor/github.com/smartystreets/assertions/equality_diff.go rename to vendor/github.com/smarty/assertions/equality_diff.go index bd698ff..c90385a 100644 --- a/vendor/github.com/smartystreets/assertions/equality_diff.go +++ b/vendor/github.com/smarty/assertions/equality_diff.go @@ -3,7 +3,7 @@ package assertions import ( "fmt" - "github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch" + "github.com/smarty/assertions/internal/go-diff/diffmatchpatch" ) func composePrettyDiff(expected, actual string) string { diff --git a/vendor/github.com/smarty/assertions/equality_specs.go b/vendor/github.com/smarty/assertions/equality_specs.go new file mode 100644 index 0000000..5f94997 --- /dev/null +++ b/vendor/github.com/smarty/assertions/equality_specs.go @@ -0,0 +1,119 @@ +package assertions + +import ( + "math" + "reflect" + "time" +) + +type specification interface { + assertable(a, b any) bool + passes(a, b any) bool +} + +var equalitySpecs = []specification{ + numericEquality{}, + timeEquality{}, + deepEquality{}, + equalityMethodSpecification{}, // Now that we have the timeEquality spec, this could probably be removed.. +} + +// deepEquality compares any two values using reflect.DeepEqual. +// https://golang.org/pkg/reflect/#DeepEqual +type deepEquality struct{} + +func (deepEquality) assertable(a, b any) bool { + return reflect.TypeOf(a) == reflect.TypeOf(b) +} +func (deepEquality) passes(a, b any) bool { + return reflect.DeepEqual(a, b) +} + +// numericEquality compares numeric values using the built-in equality +// operator (`==`). Values of differing numeric reflect.Kind are each +// converted to the type of the other and are compared with `==` in both +// directions, with one exception: two mixed integers (one signed and one +// unsigned) are always unequal in the case that the unsigned value is +// greater than math.MaxInt64. https://golang.org/pkg/reflect/#Kind +type numericEquality struct{} + +func (numericEquality) assertable(a, b any) bool { + return isNumeric(a) && isNumeric(b) +} +func (numericEquality) passes(a, b any) bool { + aValue := reflect.ValueOf(a) + bValue := reflect.ValueOf(b) + if isUnsignedInteger(a) && isSignedInteger(b) && aValue.Uint() >= math.MaxInt64 { + return false + } + if isSignedInteger(a) && isUnsignedInteger(b) && bValue.Uint() >= math.MaxInt64 { + return false + } + aAsB := aValue.Convert(bValue.Type()).Interface() + bAsA := bValue.Convert(aValue.Type()).Interface() + return a == bAsA && b == aAsB +} +func isNumeric(v any) bool { + of := reflect.TypeOf(v) + if of == nil { + return false + } + _, found := numericKinds[of.Kind()] + return found +} +func isSignedInteger(v any) bool { + _, found := signedIntegerKinds[reflect.TypeOf(v).Kind()] + return found +} + +var unsignedIntegerKinds = map[reflect.Kind]struct{}{ + reflect.Uint: {}, + reflect.Uint8: {}, + reflect.Uint16: {}, + reflect.Uint32: {}, + reflect.Uint64: {}, + reflect.Uintptr: {}, +} + +func isUnsignedInteger(v any) bool { + _, found := unsignedIntegerKinds[reflect.TypeOf(v).Kind()] + return found +} + +var signedIntegerKinds = map[reflect.Kind]struct{}{ + reflect.Int: {}, + reflect.Int8: {}, + reflect.Int16: {}, + reflect.Int32: {}, + reflect.Int64: {}, +} + +var numericKinds = map[reflect.Kind]struct{}{ + reflect.Int: {}, + reflect.Int8: {}, + reflect.Int16: {}, + reflect.Int32: {}, + reflect.Int64: {}, + reflect.Uint: {}, + reflect.Uint8: {}, + reflect.Uint16: {}, + reflect.Uint32: {}, + reflect.Uint64: {}, + reflect.Float32: {}, + reflect.Float64: {}, +} + +// timeEquality compares values both of type time.Time using their Equal method. +// https://golang.org/pkg/time/#Time.Equal +type timeEquality struct{} + +func (timeEquality) assertable(a, b any) bool { + return isTime(a) && isTime(b) +} +func (timeEquality) passes(a, b any) bool { + return a.(time.Time).Equal(b.(time.Time)) +} +func isTime(v any) bool { + _, ok := v.(time.Time) + return ok +} diff --git a/vendor/github.com/smartystreets/assertions/filter.go b/vendor/github.com/smarty/assertions/filter.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/filter.go rename to vendor/github.com/smarty/assertions/filter.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/AUTHORS b/vendor/github.com/smarty/assertions/internal/go-diff/AUTHORS similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/AUTHORS rename to vendor/github.com/smarty/assertions/internal/go-diff/AUTHORS diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/CONTRIBUTORS b/vendor/github.com/smarty/assertions/internal/go-diff/CONTRIBUTORS similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/CONTRIBUTORS rename to vendor/github.com/smarty/assertions/internal/go-diff/CONTRIBUTORS diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/LICENSE b/vendor/github.com/smarty/assertions/internal/go-diff/LICENSE similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/LICENSE rename to vendor/github.com/smarty/assertions/internal/go-diff/LICENSE diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diff.go b/vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/diff.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diff.go rename to vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/diff.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go b/vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go rename to vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/diffmatchpatch.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/match.go b/vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/match.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/match.go rename to vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/match.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/mathutil.go b/vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/mathutil.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/mathutil.go rename to vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/mathutil.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/operation_string.go b/vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/operation_string.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/operation_string.go rename to vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/operation_string.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/patch.go b/vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/patch.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/patch.go rename to vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/patch.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/stringutil.go b/vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/stringutil.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch/stringutil.go rename to vendor/github.com/smarty/assertions/internal/go-diff/diffmatchpatch/stringutil.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE b/vendor/github.com/smarty/assertions/internal/go-render/LICENSE similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-render/LICENSE rename to vendor/github.com/smarty/assertions/internal/go-render/LICENSE diff --git a/vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go b/vendor/github.com/smarty/assertions/internal/go-render/render/render.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-render/render/render.go rename to vendor/github.com/smarty/assertions/internal/go-render/render/render.go diff --git a/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_time.go b/vendor/github.com/smarty/assertions/internal/go-render/render/render_time.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/go-render/render/render_time.go rename to vendor/github.com/smarty/assertions/internal/go-render/render/render_time.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/.gitignore b/vendor/github.com/smarty/assertions/internal/oglematchers/.gitignore similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/.gitignore rename to vendor/github.com/smarty/assertions/internal/oglematchers/.gitignore diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/.travis.yml b/vendor/github.com/smarty/assertions/internal/oglematchers/.travis.yml similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/.travis.yml rename to vendor/github.com/smarty/assertions/internal/oglematchers/.travis.yml diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE b/vendor/github.com/smarty/assertions/internal/oglematchers/LICENSE similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/LICENSE rename to vendor/github.com/smarty/assertions/internal/oglematchers/LICENSE diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md b/vendor/github.com/smarty/assertions/internal/oglematchers/README.md similarity index 72% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md rename to vendor/github.com/smarty/assertions/internal/oglematchers/README.md index 215a2bb..d788325 100644 --- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/README.md +++ b/vendor/github.com/smarty/assertions/internal/oglematchers/README.md @@ -1,4 +1,4 @@ -[![GoDoc](https://godoc.org/github.com/smartystreets/assertions/internal/oglematchers?status.svg)](https://godoc.org/github.com/smartystreets/assertions/internal/oglematchers) +[![GoDoc](https://godoc.org/github.com/smarty/assertions/internal/oglematchers?status.svg)](https://godoc.org/github.com/smarty/assertions/internal/oglematchers) `oglematchers` is a package for the Go programming language containing a set of matchers, useful in a testing or mocking framework, inspired by and mostly @@ -38,7 +38,7 @@ First, make sure you have installed Go 1.0.2 or newer. See Use the following command to install `oglematchers` and keep it up to date: - go get -u github.com/smartystreets/assertions/internal/oglematchers + go get -u github.com/smarty/assertions/internal/oglematchers Documentation @@ -47,12 +47,12 @@ Documentation See [here][reference] for documentation. Alternatively, you can install the package and then use `godoc`: - godoc github.com/smartystreets/assertions/internal/oglematchers + godoc github.com/smarty/assertions/internal/oglematchers -[reference]: http://godoc.org/github.com/smartystreets/assertions/internal/oglematchers +[reference]: http://godoc.org/github.com/smarty/assertions/internal/oglematchers [golang-install]: http://golang.org/doc/install.html [googletest]: http://code.google.com/p/googletest/ [google-js-test]: http://code.google.com/p/google-js-test/ -[ogletest]: http://github.com/smartystreets/assertions/internal/ogletest -[oglemock]: http://github.com/smartystreets/assertions/internal/oglemock +[ogletest]: http://github.com/smarty/assertions/internal/ogletest +[oglemock]: http://github.com/smarty/assertions/internal/oglemock diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go b/vendor/github.com/smarty/assertions/internal/oglematchers/any_of.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/any_of.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go b/vendor/github.com/smarty/assertions/internal/oglematchers/contains.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/contains.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/contains.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go b/vendor/github.com/smarty/assertions/internal/oglematchers/deep_equals.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/deep_equals.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go b/vendor/github.com/smarty/assertions/internal/oglematchers/equals.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/equals.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/equals.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go b/vendor/github.com/smarty/assertions/internal/oglematchers/greater_or_equal.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/greater_or_equal.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go b/vendor/github.com/smarty/assertions/internal/oglematchers/greater_than.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/greater_than.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go b/vendor/github.com/smarty/assertions/internal/oglematchers/less_or_equal.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/less_or_equal.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go b/vendor/github.com/smarty/assertions/internal/oglematchers/less_than.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/less_than.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go b/vendor/github.com/smarty/assertions/internal/oglematchers/matcher.go similarity index 94% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/matcher.go index 2a59e4d..b185b31 100644 --- a/vendor/github.com/smartystreets/assertions/internal/oglematchers/matcher.go +++ b/vendor/github.com/smarty/assertions/internal/oglematchers/matcher.go @@ -17,8 +17,8 @@ // mocking framework. These matchers are inspired by and mostly compatible with // Google Test for C++ and Google JS Test. // -// This package is used by github.com/smartystreets/assertions/internal/ogletest and -// github.com/smartystreets/assertions/internal/oglemock, which may be more directly useful if you're not +// This package is used by github.com/smarty/assertions/internal/ogletest and +// github.com/smarty/assertions/internal/oglemock, which may be more directly useful if you're not // writing your own testing package or defining your own matchers. package oglematchers diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go b/vendor/github.com/smarty/assertions/internal/oglematchers/not.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/not.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/not.go diff --git a/vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go b/vendor/github.com/smarty/assertions/internal/oglematchers/transform_description.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/internal/oglematchers/transform_description.go rename to vendor/github.com/smarty/assertions/internal/oglematchers/transform_description.go diff --git a/vendor/github.com/smartystreets/assertions/messages.go b/vendor/github.com/smarty/assertions/messages.go similarity index 96% rename from vendor/github.com/smartystreets/assertions/messages.go rename to vendor/github.com/smarty/assertions/messages.go index 7a32999..4e4f1df 100644 --- a/vendor/github.com/smartystreets/assertions/messages.go +++ b/vendor/github.com/smarty/assertions/messages.go @@ -9,8 +9,8 @@ const ( shouldHaveBeenAlmostEqual = "Expected '%v' to almost equal '%v' (but it didn't)!" shouldHaveNotBeenAlmostEqual = "Expected '%v' to NOT almost equal '%v' (but it did)!" - shouldHaveResembled = "Expected: '%s'\nActual: '%s'\n(Should resemble)!" - shouldHaveResembledButTypeDiff = "Expected: '%s'\nActual: '%s'\n(Should resemble, but there is a type difference within the two)!" + shouldHaveResembled = "Expected: %s\nActual: %s\n(Should equal)!" + shouldHaveResembledButTypeDiff = "Expected: %s\nActual: %s\n(Should equal, but there is a type difference within the two)!" shouldNotHaveResembled = "Expected '%#v'\nto NOT resemble '%#v'\n(but it did)!" shouldBePointers = "Both arguments should be pointers " diff --git a/vendor/github.com/smartystreets/assertions/panic.go b/vendor/github.com/smarty/assertions/panic.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/panic.go rename to vendor/github.com/smarty/assertions/panic.go diff --git a/vendor/github.com/smartystreets/assertions/quantity.go b/vendor/github.com/smarty/assertions/quantity.go similarity index 98% rename from vendor/github.com/smartystreets/assertions/quantity.go rename to vendor/github.com/smarty/assertions/quantity.go index 6c3e725..6f57095 100644 --- a/vendor/github.com/smartystreets/assertions/quantity.go +++ b/vendor/github.com/smarty/assertions/quantity.go @@ -3,7 +3,7 @@ package assertions import ( "fmt" - "github.com/smartystreets/assertions/internal/oglematchers" + "github.com/smarty/assertions/internal/oglematchers" ) // ShouldBeGreaterThan receives exactly two parameters and ensures that the first is greater than the second. diff --git a/vendor/github.com/smartystreets/assertions/serializer.go b/vendor/github.com/smarty/assertions/serializer.go similarity index 92% rename from vendor/github.com/smartystreets/assertions/serializer.go rename to vendor/github.com/smarty/assertions/serializer.go index 3fdf5dd..eca9198 100644 --- a/vendor/github.com/smartystreets/assertions/serializer.go +++ b/vendor/github.com/smarty/assertions/serializer.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/smartystreets/assertions/internal/go-render/render" + "github.com/smarty/assertions/internal/go-render/render" ) type Serializer interface { @@ -47,7 +47,7 @@ func newSerializer() *failureSerializer { /////////////////////////////////////////////////////////////////////////////// -// FailureView is also declared in github.com/smartystreets/goconvey/convey/reporting. +// FailureView is also declared in github.com/smarty/goconvey/convey/reporting. // The json struct tags should be equal in both declarations. type FailureView struct { Message string `json:"Message"` diff --git a/vendor/github.com/smartystreets/assertions/strings.go b/vendor/github.com/smarty/assertions/strings.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/strings.go rename to vendor/github.com/smarty/assertions/strings.go diff --git a/vendor/github.com/smartystreets/assertions/time.go b/vendor/github.com/smarty/assertions/time.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/time.go rename to vendor/github.com/smarty/assertions/time.go diff --git a/vendor/github.com/smartystreets/assertions/type.go b/vendor/github.com/smarty/assertions/type.go similarity index 100% rename from vendor/github.com/smartystreets/assertions/type.go rename to vendor/github.com/smarty/assertions/type.go diff --git a/vendor/github.com/smartystreets/assertions/README.md b/vendor/github.com/smartystreets/assertions/README.md deleted file mode 100644 index b7d34d1..0000000 --- a/vendor/github.com/smartystreets/assertions/README.md +++ /dev/null @@ -1,6 +0,0 @@ -#### SMARTY DISCLAIMER: Subject to the terms of the associated license agreement, this software is freely available for your use. This software is FREE, AS IN PUPPIES, and is a gift. Enjoy your new responsibility. This means that while we may consider enhancement requests, we may or may not choose to entertain requests at our sole and absolute discretion. - -[![Build Status](https://travis-ci.org/smartystreets/assertions.svg?branch=master)](https://travis-ci.org/smartystreets/assertions) -[![Code Coverage](https://codecov.io/gh/smartystreets/assertions/branch/master/graph/badge.svg)](https://codecov.io/gh/smartystreets/assertions) -[![Go Report Card](https://goreportcard.com/badge/github.com/smartystreets/assertions)](https://goreportcard.com/report/github.com/smartystreets/assertions) -[![GoDoc](https://godoc.org/github.com/smartystreets/assertions?status.svg)](http://godoc.org/github.com/smartystreets/assertions) diff --git a/vendor/github.com/smartystreets/assertions/equal_method.go b/vendor/github.com/smartystreets/assertions/equal_method.go deleted file mode 100644 index fb39733..0000000 --- a/vendor/github.com/smartystreets/assertions/equal_method.go +++ /dev/null @@ -1,75 +0,0 @@ -package assertions - -import "reflect" - -type equalityMethodSpecification struct { - a any - b any - - aType reflect.Type - bType reflect.Type - - equalMethod reflect.Value -} - -func newEqualityMethodSpecification(a, b any) *equalityMethodSpecification { - return &equalityMethodSpecification{ - a: a, - b: b, - } -} - -func (this *equalityMethodSpecification) IsSatisfied() bool { - if !this.bothAreSameType() { - return false - } - if !this.typeHasEqualMethod() { - return false - } - if !this.equalMethodReceivesSameTypeForComparison() { - return false - } - if !this.equalMethodReturnsBool() { - return false - } - return true -} - -func (this *equalityMethodSpecification) bothAreSameType() bool { - this.aType = reflect.TypeOf(this.a) - if this.aType == nil { - return false - } - if this.aType.Kind() == reflect.Ptr { - this.aType = this.aType.Elem() - } - this.bType = reflect.TypeOf(this.b) - return this.aType == this.bType -} -func (this *equalityMethodSpecification) typeHasEqualMethod() bool { - aInstance := reflect.ValueOf(this.a) - this.equalMethod = aInstance.MethodByName("Equal") - return this.equalMethod != reflect.Value{} -} - -func (this *equalityMethodSpecification) equalMethodReceivesSameTypeForComparison() bool { - signature := this.equalMethod.Type() - return signature.NumIn() == 1 && signature.In(0) == this.aType -} - -func (this *equalityMethodSpecification) equalMethodReturnsBool() bool { - signature := this.equalMethod.Type() - return signature.NumOut() == 1 && signature.Out(0) == reflect.TypeOf(true) -} - -func (this *equalityMethodSpecification) AreEqual() bool { - a := reflect.ValueOf(this.a) - b := reflect.ValueOf(this.b) - return areEqual(a, b) && areEqual(b, a) -} -func areEqual(receiver reflect.Value, argument reflect.Value) bool { - equalMethod := receiver.MethodByName("Equal") - argumentList := []reflect.Value{argument} - result := equalMethod.Call(argumentList) - return result[0].Bool() -} diff --git a/vendor/github.com/smartystreets/goconvey/convey/assertions.go b/vendor/github.com/smartystreets/goconvey/convey/assertions.go index bff8eac..7b71f6d 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/assertions.go +++ b/vendor/github.com/smartystreets/goconvey/convey/assertions.go @@ -4,9 +4,9 @@ package convey //go:generate ./update_assertions.sh -import "github.com/smartystreets/assertions" +import "github.com/smarty/assertions" -// These assertions are forwarded from github.com/smartystreets/assertions +// These assertions are forwarded from github.com/smarty/assertions // in order to make convey self-contained. var ( ShouldAlmostEqual = assertions.ShouldAlmostEqual diff --git a/vendor/github.com/smartystreets/goconvey/convey/init.go b/vendor/github.com/smartystreets/goconvey/convey/init.go index cb930a0..c872881 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/init.go +++ b/vendor/github.com/smartystreets/goconvey/convey/init.go @@ -5,7 +5,7 @@ import ( "os" "github.com/jtolds/gls" - "github.com/smartystreets/assertions" + "github.com/smarty/assertions" "github.com/smartystreets/goconvey/convey/reporting" ) diff --git a/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go b/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go index 7a65019..b908981 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go +++ b/vendor/github.com/smartystreets/goconvey/convey/reporting/reports.go @@ -76,7 +76,7 @@ func removePackagePath(name string) string { /////////////////// FailureView //////////////////////// -// This struct is also declared in github.com/smartystreets/assertions. +// FailureView is also declared in github.com/smarty/assertions. // The json struct tags should be equal in both declarations. type FailureView struct { Message string `json:"Message"` diff --git a/vendor/github.com/smartystreets/goconvey/convey/update_assertions.sh b/vendor/github.com/smartystreets/goconvey/convey/update_assertions.sh index df28062..a2e10ee 100644 --- a/vendor/github.com/smartystreets/goconvey/convey/update_assertions.sh +++ b/vendor/github.com/smartystreets/goconvey/convey/update_assertions.sh @@ -3,8 +3,8 @@ cd "$(dirname $(realpath $0))" ASSERTIONS=($( - go tool nm "$(go list -export -f '{{.Export}}' github.com/smartystreets/assertions)" |\ - awk '/ T github\.com\/smartystreets\/assertions\.Should/{split($3, a, "."); print a[3]}' |\ + go tool nm "$(go list -export -f '{{.Export}}' github.com/smarty/assertions)" |\ + awk '/ T github\.com\/smarty\/assertions\.Should/{split($3, a, "."); print a[3]}' |\ sort | uniq)) ( @@ -14,9 +14,9 @@ ASSERTIONS=($( echo echo "//go:generate ./update_assertions.sh" echo - echo "import \"github.com/smartystreets/assertions\"" + echo "import \"github.com/smarty/assertions\"" echo - echo "// These assertions are forwarded from github.com/smartystreets/assertions" + echo "// These assertions are forwarded from github.com/smarty/assertions" echo "// in order to make convey self-contained." echo "var (" diff --git a/vendor/modules.txt b/vendor/modules.txt index ab39653..0b9acaa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,13 +9,13 @@ github.com/gopherjs/gopherjs/js # github.com/jtolds/gls v4.20.0+incompatible ## explicit github.com/jtolds/gls -# github.com/smartystreets/assertions v1.13.1 +# github.com/smarty/assertions v1.15.0 ## explicit; go 1.18 -github.com/smartystreets/assertions -github.com/smartystreets/assertions/internal/go-diff/diffmatchpatch -github.com/smartystreets/assertions/internal/go-render/render -github.com/smartystreets/assertions/internal/oglematchers -# github.com/smartystreets/goconvey v1.8.0 +github.com/smarty/assertions +github.com/smarty/assertions/internal/go-diff/diffmatchpatch +github.com/smarty/assertions/internal/go-render/render +github.com/smarty/assertions/internal/oglematchers +# github.com/smartystreets/goconvey v1.8.1 ## explicit; go 1.18 github.com/smartystreets/goconvey/convey github.com/smartystreets/goconvey/convey/gotest