MCPcopy Create free account
hub / github.com/OpenPrinting/goipp / TestAttributesConstructors

Function TestAttributesConstructors

attr_test.go:155–181  ·  view source on GitHub ↗

TestAttributesConstructors tests Attributes.Add and MakeAttr

(t *testing.T)

Source from the content-addressed store, hash-verified

153
154// TestAttributesConstructors tests Attributes.Add and MakeAttr
155func 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
184func TestMakeAttribute(t *testing.T) {

Callers

nothing calls this directly

Calls 5

AddMethod · 0.95
EqualMethod · 0.95
StringTypeAlias · 0.85
IntegerTypeAlias · 0.85
MakeAttrFunction · 0.85

Tested by

no test coverage detected