(t *testing.T)
| 1481 | } |
| 1482 | |
| 1483 | func TestAttribute_StringRepresentation(t *testing.T) { |
| 1484 | reg := newTestRegistry(t) |
| 1485 | cont := containers.DefaultContainer |
| 1486 | fac := NewAttributeFactory(cont, reg, reg) |
| 1487 | |
| 1488 | abs := fac.AbsoluteAttribute(1, "a.b") |
| 1489 | maybe := fac.MaybeAttribute(2, "c") |
| 1490 | rel := fac.RelativeAttribute(3, NewConstValue(1, types.String("d"))) |
| 1491 | cond := fac.ConditionalAttribute(4, NewConstValue(1, types.True), abs, maybe) |
| 1492 | trail := types.NewAttributeTrail("x") |
| 1493 | |
| 1494 | tests := []struct { |
| 1495 | name string |
| 1496 | stringer fmt.Stringer |
| 1497 | }{ |
| 1498 | {name: "absoluteAttribute", stringer: abs.(fmt.Stringer)}, |
| 1499 | {name: "maybeAttribute", stringer: maybe.(fmt.Stringer)}, |
| 1500 | {name: "relativeAttribute", stringer: rel.(fmt.Stringer)}, |
| 1501 | {name: "conditionalAttribute", stringer: cond.(fmt.Stringer)}, |
| 1502 | {name: "AttributeTrail", stringer: trail}, |
| 1503 | } |
| 1504 | for _, tc := range tests { |
| 1505 | t.Run(tc.name, func(t *testing.T) { |
| 1506 | if str := tc.stringer.String(); str == "" { |
| 1507 | t.Errorf("%s.String() returned empty string", tc.name) |
| 1508 | } |
| 1509 | }) |
| 1510 | } |
| 1511 | } |
nothing calls this directly
no test coverage detected