(t *testing.T)
| 70 | ) |
| 71 | |
| 72 | func TestOptions(t *testing.T) { |
| 73 | createBar3X := func() *Bar3 { |
| 74 | return &Bar3{ |
| 75 | Bar1: Bar1{Foo3{&Foo2{&Foo1{Bravo: 2}}}}, |
| 76 | Bravo: &Bar2{ |
| 77 | Bar1: Bar1{Foo3{&Foo2{&Foo1{Charlie: 7}}}}, |
| 78 | Foo3: &Foo3{&Foo2{&Foo1{Bravo: 5}}}, |
| 79 | Bravo: 4, |
| 80 | }, |
| 81 | Delta: struct{ Echo Foo1 }{Foo1{Charlie: 3}}, |
| 82 | Foo3: &Foo3{&Foo2{&Foo1{Alpha: 1}}}, |
| 83 | Alpha: "alpha", |
| 84 | } |
| 85 | } |
| 86 | createBar3Y := func() *Bar3 { |
| 87 | return &Bar3{ |
| 88 | Bar1: Bar1{Foo3{&Foo2{&Foo1{Bravo: 3}}}}, |
| 89 | Bravo: &Bar2{ |
| 90 | Bar1: Bar1{Foo3{&Foo2{&Foo1{Charlie: 8}}}}, |
| 91 | Foo3: &Foo3{&Foo2{&Foo1{Bravo: 6}}}, |
| 92 | Bravo: 5, |
| 93 | }, |
| 94 | Delta: struct{ Echo Foo1 }{Foo1{Charlie: 4}}, |
| 95 | Foo3: &Foo3{&Foo2{&Foo1{Alpha: 2}}}, |
| 96 | Alpha: "ALPHA", |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | tests := []struct { |
| 101 | label string // Test name |
| 102 | x, y interface{} // Input values to compare |
| 103 | opts []cmp.Option // Input options |
| 104 | wantEqual bool // Whether the inputs are equal |
| 105 | wantPanic bool // Whether Equal should panic |
| 106 | reason string // The reason for the expected outcome |
| 107 | }{{ |
| 108 | label: "EquateEmpty", |
| 109 | x: []int{}, |
| 110 | y: []int(nil), |
| 111 | wantEqual: false, |
| 112 | reason: "not equal because empty non-nil and nil slice differ", |
| 113 | }, { |
| 114 | label: "EquateEmpty", |
| 115 | x: []int{}, |
| 116 | y: []int(nil), |
| 117 | opts: []cmp.Option{EquateEmpty()}, |
| 118 | wantEqual: true, |
| 119 | reason: "equal because EquateEmpty equates empty slices", |
| 120 | }, { |
| 121 | label: "SortSlices", |
| 122 | x: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, |
| 123 | y: []int{1, 0, 5, 2, 8, 9, 4, 3, 6, 7}, |
| 124 | wantEqual: false, |
| 125 | reason: "not equal because element order differs", |
| 126 | }, { |
| 127 | label: "SortSlices", |
| 128 | x: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, |
| 129 | y: []int{1, 0, 5, 2, 8, 9, 4, 3, 6, 7}, |
nothing calls this directly
no test coverage detected