(t *testing.T)
| 958 | } |
| 959 | |
| 960 | func TestAttributesConditionalAttrErrorUnknown(t *testing.T) { |
| 961 | reg := newTestRegistry(t) |
| 962 | attrs := NewAttributeFactory(containers.DefaultContainer, reg, reg) |
| 963 | |
| 964 | // err ? a : b |
| 965 | tv := attrs.AbsoluteAttribute(2, "a") |
| 966 | fv := attrs.MaybeAttribute(3, "b") |
| 967 | cond := attrs.ConditionalAttribute(1, NewConstValue(0, types.NewErr("test error")), tv, fv) |
| 968 | out, err := cond.Resolve(EmptyActivation()) |
| 969 | if err == nil { |
| 970 | t.Errorf("Got %v, wanted error", out) |
| 971 | } |
| 972 | |
| 973 | // unk ? a : b |
| 974 | condUnk := attrs.ConditionalAttribute(1, NewConstValue(0, types.NewUnknown(1, nil)), tv, fv) |
| 975 | out, err = condUnk.Resolve(EmptyActivation()) |
| 976 | if err != nil { |
| 977 | t.Fatal(err) |
| 978 | } |
| 979 | if !types.IsUnknown(out.(ref.Val)) { |
| 980 | t.Errorf("Got %v, wanted unknown", out) |
| 981 | } |
| 982 | } |
| 983 | |
| 984 | func BenchmarkResolverFieldQualifier(b *testing.B) { |
| 985 | msg := &proto3pb.TestAllTypes{ |
nothing calls this directly
no test coverage detected