summaryrefslogtreecommitdiffstats
path: root/tdeioslave/smtp/test_headergeneration.cc
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:02:02 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:02:02 -0600
commitde7e5867a65e0a46f1388e3e50bc7eeddd1aecbf (patch)
treedbb3152c372f8620f9290137d461f3d9f9eba1cb /tdeioslave/smtp/test_headergeneration.cc
parent936d3cec490c13f2c5f7dd14f5e364fddaa6da71 (diff)
downloadtdebase-de7e5867a65e0a46f1388e3e50bc7eeddd1aecbf.tar.gz
tdebase-de7e5867a65e0a46f1388e3e50bc7eeddd1aecbf.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdeioslave/smtp/test_headergeneration.cc')
-rw-r--r--tdeioslave/smtp/test_headergeneration.cc86
1 files changed, 86 insertions, 0 deletions
diff --git a/tdeioslave/smtp/test_headergeneration.cc b/tdeioslave/smtp/test_headergeneration.cc
new file mode 100644
index 000000000..83d999c4a
--- /dev/null
+++ b/tdeioslave/smtp/test_headergeneration.cc
@@ -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.cc"
+