File: unsafe_test.go

package info (click to toggle)
golang-github-powerman-deepequal 0.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104 kB
  • sloc: makefile: 2
file content (23 lines) | stat: -rw-r--r-- 437 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package deepequal

import (
	"reflect"
	"testing"
)

// This test should break in reflect.Value will be modified in
// incompatible way in future Go version.
func TestForceExported(t *testing.T) {
	t.Parallel()

	var v struct{ a int }
	val := reflect.ValueOf(v).Field(0)
	var res interface{}
	func() {
		defer func() { res = recover() }()
		_ = valueInterface(val)
	}()
	if res != nil {
		t.Errorf("valueInterface panics: %v", res)
	}
}