| 858 | } |
| 859 | |
| 860 | func 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, |