(t *testing.T)
| 133 | } |
| 134 | |
| 135 | func TestDecodeFastCheckInitialized(t *testing.T) { |
| 136 | for _, test := range testValidMessages { |
| 137 | if !test.checkFastInit { |
| 138 | continue |
| 139 | } |
| 140 | for _, message := range test.decodeTo { |
| 141 | t.Run(fmt.Sprintf("%s (%T)", test.desc, message), func(t *testing.T) { |
| 142 | m := message.ProtoReflect().New() |
| 143 | opts := proto.UnmarshalOptions{ |
| 144 | AllowPartial: true, |
| 145 | } |
| 146 | out, err := opts.UnmarshalState(protoiface.UnmarshalInput{ |
| 147 | Buf: test.wire, |
| 148 | Message: m, |
| 149 | }) |
| 150 | if err != nil { |
| 151 | t.Fatalf("Unmarshal error: %v", err) |
| 152 | } |
| 153 | if got, want := (out.Flags&protoiface.UnmarshalInitialized != 0), !test.partial; got != want { |
| 154 | t.Errorf("out.Initialized = %v, want %v", got, want) |
| 155 | } |
| 156 | }) |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | type selfMerger struct { |
| 162 | src protoiface.MessageV1 |
nothing calls this directly
no test coverage detected