|
|
Ihre Kundennummer: 12345678 |
|
'
result = 'Neues Fax von 1234-93900
Neues Fax
Ihre Kundennummer: 12345678'
assert_equal(result, html.html2text)
html = ' line 1
you
-----&'
should = 'line 1
you
-----&'
assert_equal( should, html.html2text)
html = ' '
should = '* #1
* #2'
assert_equal( should, html.html2text)
html = '
> Welcome! > > Thank you for installing Zammad. >
'
should = '> Welcome!
>
> Thank you for installing Zammad.
>'
assert_equal( should, html.html2text)
html = ' some other content '
should = 'some other content'
assert_equal( should, html.html2text)
html = ' IT-Infrastruktur
'
should = 'IT-Infrastruktur'
assert_equal( should, html.html2text)
html = "some head
some content
line 1
line 2
some text later "
result = 'some head
some content
> line 1
> line 2
some text later'
assert_equal(result, html.html2text)
html = "some head
some content
line 1
line 2
some text later "
result = 'some head
some content
> line 1
> line 2
some text later'
assert_equal(result, html.html2text)
html = "some head
some content
some text later"
result = 'some head
some content
> line 1
>
> line 2
some text later'
assert_equal(result, html.html2text)
html = "Best regards,
Your Team Team
P.S.: You receive this e-mail because you are listed in our database as person who ordered a Team license. Please click here to unsubscribe from further e-mails.
-----------------------------
"
result = 'Best regards,
Your Team Team
P.S.: You receive this e-mail because you are listed in our database as person who ordered a Team license. Please click [1] here to unsubscribe from further e-mails.
-----------------------------
[1] http://www.teamviewer.example/en/company/unsubscribe.aspx?id=1009645&ident=xxx'
assert_equal(result, html.html2text)
html = " Dave and leaned her
days adam. Maybe we
want any help me that. Next morning charlie saw at their
father. Well as though adam took out here. Melvin will be more money.
Called him into this one last thing. Men-----------------------
"
result = 'Dave and leaned her days adam.
Maybe we want any help me that.
Next morning charlie saw at their father.
Well as though adam took out here. Melvin will be more money. Called him into this one last thing.
Men-----------------------'
assert_equal(result, html.html2text)
end
test 'html2html_strict function' do
html = 'test'
result = 'test'
assert_equal(result, html.html2html_strict)
html = ' test '
result = 'test'
assert_equal(result, html.html2html_strict)
html = "\n\n test \n\n\n"
result = 'test'
assert_equal(result, html.html2html_strict)
html = 'test'
result = 'test'
assert_equal(result, html.html2html_strict)
html = 'test'
result = 'test'
assert_equal(result, html.html2html_strict)
html = 'test'
result = 'test'
assert_equal(result, html.html2html_strict)
html = 'test'
result = 'test'
assert_equal(result, html.html2html_strict)
html = 'test'
result = 'test'
assert_equal(result, html.html2html_strict)
html = 'test'
result = 'test'
assert_equal(result, html.html2html_strict)
html = 'http://example.com'
result = 'http://example.com'
assert_equal(result, html.html2html_strict)
html = 'http://example.com?a=1;'
result = 'http://example.com?a=1;'
assert_equal(result, html.html2html_strict)
html = 'web.de'
result = 'web.de'
assert_equal(result, html.html2html_strict)
html = 'web.de'
result = 'web.de'
assert_equal(result, html.html2html_strict)
html = ' https://www.facebook.com/test '
result = 'https://www.facebook.com/test'
assert_equal(result, html.html2html_strict)
html = 'some text http://example.com some other text'
result = 'some text http://example.com some other text'
assert_equal(result, html.html2html_strict)
html = 'some text www.example.com some other text'
result = 'some text http://www.example.com some other text'
assert_equal(result, html.html2html_strict)
html = 'http://what-different.example.com'
result = 'http://example.com (http://what-different.example.com)'
result = 'http://example.com (http://what-different.example.com)'
assert_equal(result, html.html2html_strict)
html = 'http://EXAMPLE.com'
result = 'http://EXAMPLE.com'
assert_equal(result, html.html2html_strict)
html = 'http://example.com'
result = 'http://example.com'
assert_equal(result, html.html2html_strict)
html = 'http://example.com'
result = 'http://example.com'
assert_equal(result, html.html2html_strict)
html = "http://example.com"
result = 'http://example.com'
assert_equal(result, html.html2html_strict)
html = "http://example.com"
result = 'http://example.com'
assert_equal(result, html.html2html_strict)
html = "http://example.com "
result = 'http://example.com'
assert_equal(result, html.html2html_strict)
html = "http://example.com. "
result = 'http://example.com.'
assert_equal(result, html.html2html_strict)
html = "http://example.com, and so on "
result = 'http://example.com, and so on'
assert_equal(result, html.html2html_strict)
html = "http://example.com?lala=me, and so on "
result = 'http://example.com?lala=me, and so on'
assert_equal(result, html.html2html_strict)
html = "http://facebook.de/examplesrbog"
result = "http://facebook.de/examplesrbog"
assert_equal(result, html.html2html_strict)
html = "Damit Sie keinen Tag versäumen, empfehlen wir Ihnen den Link des Adventkalenders in Ihrer Lesezeichen-Symbolleiste zu ergänzen. "
result = "Damit Sie keinen Tag versäumen, empfehlen wir Ihnen den Link des Adventkalenders ( http://newsletters.cylex.de/) in Ihrer Lesezeichen-Symbolleiste zu ergänzen."
assert_equal(result, html.html2html_strict)
html = ' test'
result = ' test'
assert_equal(result, html.html2html_strict)
html = ' test'
result = ' test'
assert_equal(result, html.html2html_strict)
html = ' test< /b >'
result = 'test'
assert_equal(result, html.html2html_strict)
html = "test<\n/b>"
result = 'test'
assert_equal(result, html.html2html_strict)
html = "test"
result = 'test'
assert_equal(result, html.html2html_strict)
html = "test<\n/b>"
result = 'test'
assert_equal(result, html.html2html_strict)
html = "- test
\n- test
<\n/ul>"
result = ''
assert_equal(result, html.html2html_strict)
html = 'Hallo Martin, '
result = 'Hallo Martin,'
assert_equal(result, html.html2html_strict)
html = ' john.smith@example.com'
result = 'john.smith@example.com'
assert_equal(result, html.html2html_strict)
html = ' john.smith@example.com'
result = 'john.smith@example.com'
assert_equal(result, html.html2html_strict)
html = ' john.smith@example.com'
#result = 'john.smith@example.com (mailto:john.smith2@example.com)'
result = 'john.smith@example.com'
assert_equal(result, html.html2html_strict)
end
test 'signature_identify function' do
marker_template = '######SIGNATURE_MARKER######'
source = 'test'
result = 'test'
assert_equal(result, source.signature_identify(true))
source = "test\n--\nend"
result = "test\n#{marker_template}--\nend"
assert_equal(result, source.signature_identify(true))
source = "On 01/04/15 10:55, Bob Smith wrote:"
result = "#{marker_template}On 01/04/15 10:55, Bob Smith wrote:"
assert_equal(result, source.signature_identify(true))
source = "Am 03.04.2015 um 20:58 schrieb Martin Edenhofer :"
result = "#{marker_template}Am 03.04.2015 um 20:58 schrieb Martin Edenhofer :"
assert_equal(result, source.signature_identify(true))
source = "\ntest 123 \n1\n2\n3\n4\n5\n6\n7\n8\n9\n--\nBob Smith\n"
result = "\ntest 123 \n1\n2\n3\n4\n5\n6\n7\n8\n9\n#{marker_template}--\nBob Smith\n"
assert_equal(result, source.signature_identify(true))
source = "test 123 \n--no not match--\n--\nBob Smith\n"
result = "test 123 \n--no not match--\n#{marker_template}--\nBob Smith\n"
assert_equal(result, source.signature_identify(true))
source = "test 123 \n--no not match--\n -- \nBob Smith\n"
result = "test 123 \n--no not match--\n#{marker_template} -- \nBob Smith\n"
assert_equal(result, source.signature_identify(true))
source = "test 123 \n\n--\nBob Smith\n\n\n\n\n--\nBob Smith\n"
result = "test 123 \n#{marker_template}\n--\nBob Smith\n\n\n\n\n--\nBob Smith\n"
assert_equal(result, source.signature_identify(true))
source = "test 123\ntest 123\n--\nBob Smith\n"
result = "test 123\ntest 123\n#{marker_template}--\nBob Smith\n"
assert_equal(result, source.signature_identify(true))
source = "test 123\ntest 123\n--\nBob Smith\n\n"
result = "test 123\ntest 123\n#{marker_template}--\nBob Smith\n\n"
assert_equal(result, source.signature_identify(true))
# apple
# en
source = "test 123 \n--no not match--\nBob Smith\nOn 01/04/15 10:55, Bob Smith wrote:\nlalala\n--\nsome test"
result = "test 123 \n--no not match--\nBob Smith\n#{marker_template}On 01/04/15 10:55, Bob Smith wrote:\nlalala\n#{marker_template}--\nsome test"
assert_equal(result, source.signature_identify(true))
# de
source = "test 123 \n\n--no not match--\n\nBob Smith\nAm 03.04.2015 um 20:58 schrieb Bob Smith :\nlalala"
result = "test 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}Am 03.04.2015 um 20:58 schrieb Bob Smith :\nlalala"
assert_equal(result, source.signature_identify(true))
# ms
# en
source = "test 123 \n\n--no not match--\n\nBob Smith\nFrom: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nSent: Donnerstag, 2. April 2015 10:00\nlalala"
result = "test 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nSent: Donnerstag, 2. April 2015 10:00\nlalala "
assert_equal(result, source.signature_identify(true))
# de
source = "test 123 \n\n--no not match--\n\nBob Smith\nVon: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nGesendet: Donnerstag, 2. April 2015 10:00\nBetreff: lalala\n"
result = "test 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nGesendet: Donnerstag, 2. April 2015 10:00\nBetreff: lalala\n"
assert_equal(result, source.signature_identify(true))
# fr
source = "\ntest 123 \n\n--no not match--\n\nBob Smith\nDe : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nEnvoyé : mercredi 29 avril 2015 17:31\nObjet : lalala\n"
result = "\ntest 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nEnvoyé : mercredi 29 avril 2015 17:31\nObjet : lalala\n"
assert_equal(result, source.signature_identify(true))
marker_template = ''
html = " lalala -- Max Mix"
result = "lalala #{marker_template}-- Max Mix"
assert_equal(result, html.html2html_strict(true))
html = "den.
Von: Fritz Bauer [mailto:me@example.com] Gesendet: Donnerstag, 3. Mai 2012 11:51 An: John Smith Cc: Smith, John Marian; johnel.fratczak@example.com; ole.brei@example.com; Günther John | Example GmbH; bkopon@example.com; john.heisterhagen@team.example.com; sven.rocked@example.com; michael.house@example.com; tgutzeit@example.com Betreff: Re: OTRS::XXX Erweiterung - Anhänge an CI's
Hallo,
ich versuche an den Punkten"
result = "den. #{marker_template} Von: Fritz Bauer [mailto:me@example.com] Gesendet: Donnerstag, 3. Mai 2012 11:51 An: John Smith Cc: Smith, John Marian; johnel.fratczak@example.com; ole.brei@example.com; Günther John | Example GmbH; bkopon@example.com; john.heisterhagen@team.example.com; sven.rocked@example.com; michael.house@example.com; tgutzeit@example.com Betreff: Re: OTRS::XXX Erweiterung - Anhänge an CI's
Hallo,
ich versuche an den Punkten"
assert_equal(result, html.html2html_strict(true))
end
end
|