| 1 | //nolint:testpackage // Testing internals. |
| 2 | package deepequal |
| 3 | |
| 4 | import ( |
| 5 | "reflect" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | // This test should break in reflect.Value will be modified in |
| 10 | // incompatible way in future Go version. |
| 11 | func TestForceExported(t *testing.T) { |
| 12 | t.Parallel() |
| 13 | |
| 14 | var v struct{ a int } |
| 15 | val := reflect.ValueOf(v).Field(0) |
| 16 | var res any |
| 17 | func() { |
| 18 | defer func() { res = recover() }() |
| 19 | _ = valueInterface(val) |
| 20 | }() |
| 21 | if res != nil { |
| 22 | t.Errorf("valueInterface panics: %v", res) |
| 23 | } |
| 24 | } |