@@ -760,18 +760,26 @@ const (
760
760
Anything = "mock.Anything"
761
761
)
762
762
763
- // AnythingOfTypeArgument is a string that contains the type of an argument
763
+ // AnythingOfTypeArgument contains the type of an argument
764
764
// for use when type checking. Used in Diff and Assert.
765
- type AnythingOfTypeArgument string
765
+ //
766
+ // Deprecated: this is an implementation detail that must not be used. Use [AnythingOfType] instead.
767
+ type AnythingOfTypeArgument = anythingOfTypeArgument
768
+
769
+ // anythingOfTypeArgument is a string that contains the type of an argument
770
+ // for use when type checking. Used in Diff and Assert.
771
+ type anythingOfTypeArgument string
766
772
767
- // AnythingOfType returns an AnythingOfTypeArgument object containing the
768
- // name of the type to check for. Used in Diff and Assert.
773
+ // AnythingOfType returns a special value containing the
774
+ // name of the type to check for. The type name will be matched against the type name returned by [reflect.Type.String].
775
+ //
776
+ // Used in Diff and Assert.
769
777
//
770
778
// For example:
771
779
//
772
780
// Assert(t, AnythingOfType("string"), AnythingOfType("int"))
773
781
func AnythingOfType (t string ) AnythingOfTypeArgument {
774
- return AnythingOfTypeArgument (t )
782
+ return anythingOfTypeArgument (t )
775
783
}
776
784
777
785
// IsTypeArgument is a struct that contains the type of an argument
@@ -952,9 +960,9 @@ func (args Arguments) Diff(objects []interface{}) (string, int) {
952
960
differences ++
953
961
output = fmt .Sprintf ("%s\t %d: FAIL: %s not matched by %s\n " , output , i , actualFmt , matcher )
954
962
}
955
- } else if reflect .TypeOf (expected ) == reflect .TypeOf ((* AnythingOfTypeArgument )(nil )).Elem () {
963
+ } else if reflect .TypeOf (expected ) == reflect .TypeOf ((* anythingOfTypeArgument )(nil )).Elem () {
956
964
// type checking
957
- if reflect .TypeOf (actual ).Name () != string (expected .(AnythingOfTypeArgument )) && reflect .TypeOf (actual ).String () != string (expected .(AnythingOfTypeArgument )) {
965
+ if reflect .TypeOf (actual ).Name () != string (expected .(anythingOfTypeArgument )) && reflect .TypeOf (actual ).String () != string (expected .(anythingOfTypeArgument )) {
958
966
// not match
959
967
differences ++
960
968
output = fmt .Sprintf ("%s\t %d: FAIL: type %s != type %s - %s\n " , output , i , expected , reflect .TypeOf (actual ).Name (), actualFmt )
0 commit comments