MCPcopy
hub / github.com/google/go-cmp / reporterTests

Function reporterTests

cmp/compare_test.go:860–1424  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

858}
859
860func reporterTests() []test {
861 const label = "Reporter"
862
863 type (
864 MyString string
865 MyByte byte
866 MyBytes []byte
867 MyInt int8
868 MyInts []int8
869 MyUint int16
870 MyUints []int16
871 MyFloat float32
872 MyFloats []float32
873 MyComposite struct {
874 StringA string
875 StringB MyString
876 BytesA []byte
877 BytesB []MyByte
878 BytesC MyBytes
879 IntsA []int8
880 IntsB []MyInt
881 IntsC MyInts
882 UintsA []uint16
883 UintsB []MyUint
884 UintsC MyUints
885 FloatsA []float32
886 FloatsB []MyFloat
887 FloatsC MyFloats
888 }
889 PointerString *string
890 )
891
892 return []test{{
893 label: label + "/PanicStringer",
894 x: struct{ X fmt.Stringer }{struct{ fmt.Stringer }{nil}},
895 y: struct{ X fmt.Stringer }{bytes.NewBuffer(nil)},
896 wantEqual: false,
897 reason: "panic from fmt.Stringer should not crash the reporter",
898 }, {
899 label: label + "/PanicError",
900 x: struct{ X error }{struct{ error }{nil}},
901 y: struct{ X error }{errors.New("")},
902 wantEqual: false,
903 reason: "panic from error should not crash the reporter",
904 }, {
905 label: label + "/AmbiguousType",
906 x: foo1.Bar{},
907 y: foo2.Bar{},
908 wantEqual: false,
909 reason: "reporter should display the qualified type name to disambiguate between the two values",
910 }, {
911 label: label + "/AmbiguousPointer",
912 x: newInt(0),
913 y: newInt(0),
914 opts: []cmp.Option{
915 cmp.Comparer(func(x, y *int) bool { return x == y }),
916 },
917 wantEqual: false,

Callers 1

TestDiffFunction · 0.85

Calls 7

ComparerFunction · 0.92
newIntFunction · 0.85
newStringerFunction · 0.85
MyBytesTypeAlias · 0.85
StringerTypeAlias · 0.70
MyStringTypeAlias · 0.70
StringMethod · 0.65

Tested by

no test coverage detected