Merge pull request #16 from mcarpenter/master
Issue #15: LDIF continuation character
This commit is contained in:
commit
5c3cbb7fe6
3 changed files with 88 additions and 76 deletions
|
@ -117,8 +117,8 @@ class Net::LDAP::Dataset < Hash
|
|||
while line
|
||||
new_line = io.gets
|
||||
|
||||
if new_line =~ /^[\s]+/
|
||||
line << " " << $'
|
||||
if new_line =~ /^ /
|
||||
line << $'
|
||||
else
|
||||
nextline = new_line
|
||||
|
||||
|
|
|
@ -32,7 +32,19 @@ class TestLdif < Test::Unit::TestCase
|
|||
|
||||
def test_ldif_with_continuation_lines
|
||||
ds = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hijklmn\r\n\r\n"))
|
||||
assert_equal(true, ds.has_key?("abcdefg hijklmn"))
|
||||
assert_equal(true, ds.has_key?("abcdefghijklmn"))
|
||||
end
|
||||
|
||||
def test_ldif_with_continuation_lines_and_extra_whitespace
|
||||
ds1 = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hijklmn\r\n\r\n"))
|
||||
assert_equal(true, ds1.has_key?("abcdefg hijklmn"))
|
||||
ds2 = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hij klmn\r\n\r\n"))
|
||||
assert_equal(true, ds2.has_key?("abcdefghij klmn"))
|
||||
end
|
||||
|
||||
def test_ldif_tab_is_not_continuation
|
||||
ds = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: key\r\n\tnotcontinued\r\n\r\n"))
|
||||
assert_equal(true, ds.has_key?("key"))
|
||||
end
|
||||
|
||||
# TODO, INADEQUATE. We need some more tests
|
||||
|
|
Loading…
Reference in a new issue