TestAttributesConstructors tests Attributes.Add and MakeAttr
(t *testing.T)
| 153 | |
| 154 | // TestAttributesConstructors tests Attributes.Add and MakeAttr |
| 155 | func TestAttributesConstructors(t *testing.T) { |
| 156 | attrs1 := Attributes{ |
| 157 | Attribute{ |
| 158 | Name: "attr1", |
| 159 | Values: Values{ |
| 160 | {TagString, String("hello")}, |
| 161 | {TagString, String("world")}, |
| 162 | }, |
| 163 | }, |
| 164 | Attribute{ |
| 165 | Name: "attr2", |
| 166 | Values: Values{ |
| 167 | {TagInteger, Integer(1)}, |
| 168 | {TagInteger, Integer(2)}, |
| 169 | {TagInteger, Integer(3)}, |
| 170 | }, |
| 171 | }, |
| 172 | } |
| 173 | |
| 174 | attrs2 := Attributes{} |
| 175 | attrs2.Add(MakeAttr("attr1", TagString, String("hello"), String("world"))) |
| 176 | attrs2.Add(MakeAttr("attr2", TagInteger, Integer(1), Integer(2), Integer(3))) |
| 177 | |
| 178 | if !attrs1.Equal(attrs2) { |
| 179 | t.Errorf("Attributes constructors test failed") |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | // TestMakeAttribute tests MakeAttribute function |
| 184 | func TestMakeAttribute(t *testing.T) { |