(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestAttributeCollection(t *testing.T) { |
| 94 | // Create a new AttributeCollection with two attributes |
| 95 | attr1, err := attribute.Attribute("book:b1$status|string:published") |
| 96 | assert.NoError(t, err) |
| 97 | |
| 98 | attr2, err := attribute.Attribute("book:b2$status|string:draft") |
| 99 | assert.NoError(t, err) |
| 100 | |
| 101 | attrColl := NewAttributeCollection(attr1, attr2) |
| 102 | |
| 103 | // Test the CreateAttributeIterator method |
| 104 | iter := attrColl.CreateAttributeIterator() |
| 105 | assert.NotNil(t, iter) |
| 106 | |
| 107 | // Test the GetAttributes method |
| 108 | attributes := attrColl.GetAttributes() |
| 109 | assert.Equal(t, 2, len(attributes)) |
| 110 | assert.Equal(t, attr1, attributes[0]) |
| 111 | assert.Equal(t, attr2, attributes[1]) |
| 112 | |
| 113 | // Test the Add method |
| 114 | attr3, err := attribute.Attribute("book:b3$status|string:archived") |
| 115 | assert.NoError(t, err) |
| 116 | |
| 117 | attrColl.Add(attr3) |
| 118 | attributes = attrColl.GetAttributes() |
| 119 | assert.Equal(t, 3, len(attributes)) |
| 120 | assert.Equal(t, attr3, attributes[2]) |
| 121 | } |
| 122 | |
| 123 | func TestEmptyCollections(t *testing.T) { |
| 124 | // Test empty TupleCollection |
nothing calls this directly
no test coverage detected