MCPcopy Create free account
hub / github.com/crewjam/saml / TestAttributeValueEmptyIsNotNil

Function TestAttributeValueEmptyIsNotNil

attribute_value_test.go:47–54  ·  view source on GitHub ↗

An empty element without xsi:nil is an empty string, not a null value.

(t *testing.T)

Source from the content-addressed store, hash-verified

45
46// An empty element without xsi:nil is an empty string, not a null value.
47func TestAttributeValueEmptyIsNotNil(t *testing.T) {
48 got := attributeValueParse(t, `<saml:Attribute xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Name="a"><saml:AttributeValue/></saml:Attribute>`)
49 assert.Check(t, !got.Nil)
50 assert.Check(t, is.Equal("", got.Value))
51
52 el := (&AttributeValue{}).Element()
53 assert.Check(t, el.SelectAttr("xsi:nil") == nil)
54}
55
56func TestAttributeValueNilRoundTrip(t *testing.T) {
57 // Value is ignored for a null value: the element MUST be empty.

Callers

nothing calls this directly

Calls 2

attributeValueParseFunction · 0.85
ElementMethod · 0.45

Tested by

no test coverage detected