.autotest: MimeHeader

git-svn-id: svn://ultimatepp.org/upp/trunk@7181 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-04-07 09:14:07 +00:00
parent f541de177c
commit 061e5e65e2
3 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,47 @@
#include <Core/Core.h>
#include <Core/POP3/POP3.h>
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");
}

View file

@ -0,0 +1,10 @@
uses
Core,
Core/POP3;
file
MimeHeader.cpp;
mainconfig
"" = "SSE2";

5
autotest/MimeHeader/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _MimeHeader_icpp_init_stub
#define _MimeHeader_icpp_init_stub
#include "Core/init"
#include "Core/POP3/init"
#endif