(t *testing.T)
| 199 | } |
| 200 | |
| 201 | func TestExtensionLazyDeterministic(t *testing.T) { |
| 202 | if !flags.LazyUnmarshalExtensions { |
| 203 | t.Skip("lazy extension unmarshaling disabled; not built with the protolegacy tag") |
| 204 | } |
| 205 | |
| 206 | tree := proto.Clone(treeTemplate) |
| 207 | proto.SetExtension(tree, lazytestpb.E_Bat, &lazytestpb.FlyingFox{Species: &spGH}) |
| 208 | proto.SetExtension(tree, lazytestpb.E_BatPup, &lazytestpb.FlyingFox{Species: &spP}) |
| 209 | |
| 210 | nt := roundtrip(t, tree).(*lazytestpb.Tree) |
| 211 | |
| 212 | if extensionIsInitialized(t, nt, lazytestpb.E_Bat) { |
| 213 | t.Errorf("Extension unexpectedly initialized after Unmarshal") |
| 214 | } |
| 215 | proto.Size(nt) |
| 216 | if extensionIsInitialized(t, nt, lazytestpb.E_Bat) { |
| 217 | t.Errorf("Extension unexpectedly initialized after Size") |
| 218 | } |
| 219 | proto.MarshalOptions{Deterministic: true}.Size(nt) |
| 220 | if !extensionIsInitialized(t, nt, lazytestpb.E_Bat) { |
| 221 | t.Errorf("Extension unexpectedly not initialized after deterministic Size") |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | func TestExtensionNestedScopeLazy(t *testing.T) { |
| 226 | if !flags.LazyUnmarshalExtensions { |
nothing calls this directly
no test coverage detected