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
|
while line
|
||||||
new_line = io.gets
|
new_line = io.gets
|
||||||
|
|
||||||
if new_line =~ /^[\s]+/
|
if new_line =~ /^ /
|
||||||
line << " " << $'
|
line << $'
|
||||||
else
|
else
|
||||||
nextline = new_line
|
nextline = new_line
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,18 @@ class TestLdif < Test::Unit::TestCase
|
||||||
assert_equal(true, ds.has_key?("abcdefghijklmn"))
|
assert_equal(true, ds.has_key?("abcdefghijklmn"))
|
||||||
end
|
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
|
# TODO, INADEQUATE. We need some more tests
|
||||||
# to verify the content.
|
# to verify the content.
|
||||||
def test_ldif
|
def test_ldif
|
||||||
|
|
Loading…
Reference in a new issue