summaryrefslogtreecommitdiffstats
path: root/tdeioslave/smtp/test_headergeneration.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-12-07 22:58:44 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-12-07 22:58:44 +0900
commit145abc15d57fb29701a12e8a14dcb9c1fd72e9be (patch)
treefbb4f2f737ec6f4e8a85bea5f2ca2257d20d7e22 /tdeioslave/smtp/test_headergeneration.cpp
parentd95494d97233919fa0b2eebf60759537b793e05b (diff)
downloadtdebase-145abc15d57fb29701a12e8a14dcb9c1fd72e9be.tar.gz
tdebase-145abc15d57fb29701a12e8a14dcb9c1fd72e9be.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdeioslave/smtp/test_headergeneration.cpp')
-rw-r--r--tdeioslave/smtp/test_headergeneration.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/tdeioslave/smtp/test_headergeneration.cpp b/tdeioslave/smtp/test_headergeneration.cpp
new file mode 100644
index 000000000..9e4cb971f
--- /dev/null
+++ b/tdeioslave/smtp/test_headergeneration.cpp
@@ -0,0 +1,86 @@
+#include "request.h"
+
+//#include <iostream>
+
+//using std::cout;
+//using std::endl;
+
+int main( int , char ** ) {
+ static TQCString expected =
+ "From: mutz@kde.org\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: Marc Mutz <mutz@kde.org>\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: \"Mutz, Marc\" <mutz@kde.org>\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: =?utf-8?b?TWFyYyBNw7Z0eg==?= <mutz@kde.org>\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: mutz@kde.org\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: Marc Mutz <mutz@kde.org>\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: \"Mutz, Marc\" <mutz@kde.org>\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: =?utf-8?b?TWFyYyBNw7Z0eg==?= <mutz@kde.org>\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n";
+
+ KioSMTP::Request request;
+ TQCString result;
+
+ request.setEmitHeaders( true );
+ request.setFromAddress( "mutz@kde.org" );
+ request.addTo( "joe@user.org" );
+ request.addTo( "valentine@14th.february.org" );
+ request.addCc( "boss@example.com" );
+
+ result += request.headerFields() + '\n';
+ result += request.headerFields( "Marc Mutz" ) + '\n';
+ result += request.headerFields( "Mutz, Marc" ) + '\n';
+ result += request.headerFields( "Marc Mötz" ) + '\n';
+
+ request.setSubject( "Blödes Subject" );
+
+ result += request.headerFields() + '\n';
+ result += request.headerFields( "Marc Mutz" ) + '\n';
+ result += request.headerFields( "Mutz, Marc" ) + '\n';
+ result += request.headerFields( "Marc Mötz" ) + '\n';
+
+ //cout << "Result:\n" << result.data() << endl;
+
+ return result == expected ? 0 : 1 ;
+}
+
+#include "request.cpp"
+