diff --git a/autotest/MimeHeader/MimeHeader.cpp b/autotest/MimeHeader/MimeHeader.cpp new file mode 100644 index 000000000..fbbd91cae --- /dev/null +++ b/autotest/MimeHeader/MimeHeader.cpp @@ -0,0 +1,47 @@ +#include +#include + +using namespace Upp; + +String etalon; + +void Test(const String& ct, const String& val = Null) +{ + MIMEHeader h; + h.Parse(ct); + String s = AsString(h); + LOG(ct); + LOG(" " << h); + if(val.GetCount()) + ASSERT(s == val); + etalon << "Test(" << AsCString(ct) << ",\r\n " << AsCString(s) << ");\r\n"; +} + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + Test("Content-Type: text/plain", + "Content-Type: text/plain"); + Test("Content-Type: multipart/mixed; boundary=001a11c12a1ca56b2b04f66f1aca", + "Content-Type: multipart/mixed; boundary=\"001a11c12a1ca56b2b04f66f1aca\""); + Test("Content-Disposition: attachment; filename=genome.jpeg;modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\";", + "Content-Disposition: attachment; filename=\"genome.jpeg\"; modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\""); + Test("Content-Type: application/rtf; name=\"\\\";.rtf\"", + "Content-Type: application/rtf; name=\"\\\";.rtf\""); + Test("Content-Disposition: attachment; filename=\"\\\";.rtf\"", + "Content-Disposition: attachment; filename=\"\\\";.rtf\""); + Test("Content-Type: application/rtf; name=\"\\\";.rtf\";test=b", + "Content-Type: application/rtf; name=\"\\\";.rtf\"; test=\"b\""); + Test("Content-Transfer-Encoding: base64", + "Content-Transfer-Encoding: base64"); + Test("Content-Type: text/plain; charset=\"iso-8859-1\"", + "Content-Type: text/plain; charset=\"iso-8859-1\""); + Test("Content-Type: text/plain; charset=iso-8859-1", + "Content-Type: text/plain; charset=\"iso-8859-1\""); + + LOG("--- ETALONS ------------------"); + LOG(etalon); + + LOG("================ OK"); +} diff --git a/autotest/MimeHeader/MimeHeader.upp b/autotest/MimeHeader/MimeHeader.upp new file mode 100644 index 000000000..699f4dec2 --- /dev/null +++ b/autotest/MimeHeader/MimeHeader.upp @@ -0,0 +1,10 @@ +uses + Core, + Core/POP3; + +file + MimeHeader.cpp; + +mainconfig + "" = "SSE2"; + diff --git a/autotest/MimeHeader/init b/autotest/MimeHeader/init new file mode 100644 index 000000000..c71720567 --- /dev/null +++ b/autotest/MimeHeader/init @@ -0,0 +1,5 @@ +#ifndef _MimeHeader_icpp_init_stub +#define _MimeHeader_icpp_init_stub +#include "Core/init" +#include "Core/POP3/init" +#endif