(t *testing.T)
| 795 | } |
| 796 | |
| 797 | func TestAttributesConditionalAttrErrorUnknown(t *testing.T) { |
| 798 | reg := newTestRegistry(t) |
| 799 | attrs := NewAttributeFactory(containers.DefaultContainer, reg, reg) |
| 800 | |
| 801 | // err ? a : b |
| 802 | tv := attrs.AbsoluteAttribute(2, "a") |
| 803 | fv := attrs.MaybeAttribute(3, "b") |
| 804 | cond := attrs.ConditionalAttribute(1, NewConstValue(0, types.NewErr("test error")), tv, fv) |
| 805 | out, err := cond.Resolve(EmptyActivation()) |
| 806 | if err == nil { |
| 807 | t.Errorf("Got %v, wanted error", out) |
| 808 | } |
| 809 | |
| 810 | // unk ? a : b |
| 811 | condUnk := attrs.ConditionalAttribute(1, NewConstValue(0, types.NewUnknown(1, nil)), tv, fv) |
| 812 | out, err = condUnk.Resolve(EmptyActivation()) |
| 813 | if err != nil { |
| 814 | t.Fatal(err) |
| 815 | } |
| 816 | if !types.IsUnknown(out.(ref.Val)) { |
| 817 | t.Errorf("Got %v, wanted unknown", out) |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | func BenchmarkResolverFieldQualifier(b *testing.B) { |
| 822 | msg := &proto3pb.TestAllTypes{ |
nothing calls this directly
no test coverage detected