-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatch_test.go
More file actions
62 lines (53 loc) · 1.21 KB
/
match_test.go
File metadata and controls
62 lines (53 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package protopatch_test
// import (
// "reflect"
// "testing"
// protopatchv1 "github.com/daishe/protopatch/internal/testtypes/protopatch/v1"
// "google.golang.org/protobuf/proto"
// )
// func TestMatch(t *testing.T) {
// var a = []*protopatchv1.TestMessage{}
// var b []proto.Message
// t.Log("testing a")
// foo(t, a)
// t.Log("testing b")
// foo(t, b)
// t.Fail()
// }
// var messageType = reflect.TypeOf((*proto.Message)(nil)).Elem()
// func foo(t *testing.T, x any) {
// v := reflect.Zero(reflect.TypeOf(x).Elem())
// t.Logf("type=%v", v.Type().Name())
// if v.Type() == messageType {
// t.Logf("is message type")
// } else {
// t.Logf("is not message type")
// }
// if !v.IsValid() {
// t.Logf("invalid reflect value")
// return
// }
// // if v.IsNil() {
// // t.Logf("nil reflect value")
// // return
// // }
// m, ok := v.Interface().(proto.Message)
// if !ok {
// t.Logf("not a message")
// return
// }
// if m == nil {
// t.Logf("message is nil")
// return
// }
// pr := m.ProtoReflect()
// if pr == nil {
// t.Logf("proto reflect is nil")
// return
// }
// if pr.Descriptor() == nil {
// t.Logf("message descriptor is nil")
// return
// }
// t.Logf("no nils")
// }