'strips extraneous whitespace without modifying the multivalued RDN'|'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'strips the space after the plus sign in the telephoneNumber'|'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'for a null DN (empty string), returns empty string and does not error'|''|''
'does not strip the escaped leading space in an attribute value (and does not error like Net::LDAP::DN.new does)'|'uid=\\ John Smith,ou=People,dc=example,dc=com'|'uid=\\ John Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing space in an attribute value'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'
'does not strip the escaped leading newline in an attribute value'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing newline in an attribute value'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'
'does not strip the unescaped leading newline in an attribute value'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the unescaped trailing newline in an attribute value'|'uid=John Smith\n ,ou=People,dc=example,dc=com'|'uid=John Smith\n,ou=People,dc=example,dc=com'
'does not modify casing'|'UID=John Smith,ou=People,dc=example,dc=com'|'UID=John Smith,ou=People,dc=example,dc=com'
'does not strip non whitespace'|'uid=John Smith,ou=People,dc=example,dc=com'|'uid=John Smith,ou=People,dc=example,dc=com'
'for a malformed DN (when an equal sign is escaped), returns the DN completely unmodified'|'uid= foo\\=bar'|'uid= foo\\=bar'
end
context'when there is an escaped trailing newline in an attribute value'do
it'does not remove the escaped trailing newline'do
'strips extraneous whitespace without modifying the multivalued RDN'|'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'strips the space after the plus sign in the telephoneNumber'|'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'for a null DN (empty string), returns empty string and does not error'|''|''
'does not strip the escaped leading space in an attribute value (and does not error like Net::LDAP::DN.new does)'|'uid=\\ John Smith,ou=People,dc=example,dc=com'|'uid=\\ John Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing space in an attribute value'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'
'does not strip the escaped leading newline in an attribute value'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing newline in an attribute value'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'
'does not strip the unescaped leading newline in an attribute value'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the unescaped trailing newline in an attribute value'|'uid=John Smith\n ,ou=People,dc=example,dc=com'|'uid=John Smith\n,ou=People,dc=example,dc=com'
'does not modify casing'|'UID=John Smith,ou=People,dc=example,dc=com'|'UID=John Smith,ou=People,dc=example,dc=com'
'does not strip non whitespace'|'uid=John Smith,ou=People,dc=example,dc=com'|'uid=John Smith,ou=People,dc=example,dc=com'
'for a malformed DN (when an equal sign is escaped), returns the DN completely unmodified'|'uid= foo\\=bar'|'uid= foo\\=bar'