X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Ftest_header_parsing.rb;h=91cf7c76f66b020874a5e2bedece3c8fc83f626c;hb=053f4a827929f7101e7c98e1bb9248f6eaf006e3;hp=7368d81ff7bed7423472391450555f24ae887fa3;hpb=45ff840e6bbe95e34195435ea97ecf268168231a;p=sup diff --git a/test/test_header_parsing.rb b/test/test_header_parsing.rb index 7368d81..91cf7c7 100644 --- a/test/test_header_parsing.rb +++ b/test/test_header_parsing.rb @@ -104,4 +104,54 @@ EOS assert_equal "Bob ", h["from"] assert_nil h["to"] end + + def test_from_line_splitting + l = MBox::Loader.new StringIO.new(< +To: a dear friend + +Hello there friend. How are you? + +From sea to shining sea + +From bob@bob.com I get only spam. + +From bob@bob.com + +From bob@bob.com + +(that second one has spaces at the endj + +This is the end of the email. +EOS + offset, labels = l.next + assert_equal 0, offset + offset, labels = l.next + assert_nil offset + end + + def test_more_from_line_splitting + l = MBox::Loader.new StringIO.new(< +To: a dear friend + +Hello there friend. How are you? + +From bob@bob.com Mon Apr 27 12:56:19 2009 +From: Bob +To: a dear friend + +Hello again! Would you like to buy my products? +EOS + offset, labels = l.next + assert_not_nil offset + + offset, labels = l.next + assert_not_nil offset + + offset, labels = l.next + assert_nil offset + end end