Debian Codegraph @

internal/sysenc/layout_test.go

raw symbols SCIP
1 package sysenc
2
3 import (
4 "fmt"
5 "reflect"
6 "testing"
7
8 "github.com/go-quicktest/qt"
9 )
10
11 func TestHasUnexportedFields(t *testing.T) {
12 for _, test := range []struct {
13 value any
14 result bool
15 }{
16 {struct{ A any }{}, false},
17 {(*struct{ A any })(nil), false},
18 {([]struct{ A any })(nil), false},
19 {[1]struct{ A any }{}, false},
20 {struct{ _ any }{}, false},
21 {struct{ _ struct{ a any } }{}, true},
22 {(*struct{ _ any })(nil), false},
23 {([]struct{ _ any })(nil), false},
24 {[1]struct{ _ any }{}, false},
25 {struct{ a any }{}, true},
26 {(*struct{ a any })(nil), true},
27 {([]struct{ a any })(nil), true},
28 {[1]struct{ a any }{}, true},
29 {(*struct{ A []struct{ a any } })(nil), true},
30 {(*struct{ A [1]struct{ a any } })(nil), true},
31 } {
32 t.Run(fmt.Sprintf("%T", test.value), func(t *testing.T) {
33 have := hasUnexportedFields(reflect.TypeOf(test.value))
34 qt.Assert(t, qt.Equals(have, test.result))
35 })
36 }
37 }