X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=libcitadel%2Ftests%2Fstringbuf_conversion.c;h=c73ece4d273d9489bd647d0391880d1897dabdf0;hb=b826c3117bb7ddf1386a4811cb2eb47ea4e1097c;hp=cb3dcb667f8c920f67c3f67754dac2156e8cdb25;hpb=62bfc6a0f13dcb84304c83d252119269ede3bf96;p=citadel.git diff --git a/libcitadel/tests/stringbuf_conversion.c b/libcitadel/tests/stringbuf_conversion.c index cb3dcb667..c73ece4d2 100644 --- a/libcitadel/tests/stringbuf_conversion.c +++ b/libcitadel/tests/stringbuf_conversion.c @@ -1,9 +1,8 @@ - /* * CUnit - A Unit testing framework library for C. * Copyright (C) 2001 Anil Kumar * - * This library is free software; you can redistribute it and/or + * This library is open source software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. @@ -12,10 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include @@ -326,6 +321,33 @@ static void TestEncodeEmailSTDIN(void) FreeStrBuf(&Source); } +static void StrBufRFC2047encodeMessageStdin(void) +{ + int fdin = 0;// STDIN + const char *Err; + StrBuf *Target; + StrBuf *Source; + StrBuf *Src; + + Source = NewStrBuf(); + Src = NewStrBuf(); + + printf("["); + while (fdin == 0) { + + StrBufTCP_read_line(Source, &fdin, 0, &Err); + StrBufAppendBuf(Src, Source, 0); + StrBufAppendBufPlain(Src, HKEY("\n"), 0); + + } + + Target = StrBufRFC2047encodeMessage(Src); + + printf("Target: \n%s\n", ChrPtr(Target)); + FreeStrBuf(&Source); + FreeStrBuf(&Src); + FreeStrBuf(&Target); +} static void TestHTML2ASCII_line(void) { @@ -340,7 +362,7 @@ static void TestHTML2ASCII_line(void) StrBufTCP_read_line(Source, &fdin, 0, &Err); printf("the source:>%s<\n", ChrPtr(Source)); - Target = html_to_ascii(ChrPtr(Source), StrLength(Source), 80, 0); + Target = html_to_ascii(ChrPtr(Source), StrLength(Source), 80); printf("the target:>%s<\n", Target); FlushStrBuf(Source); @@ -395,6 +417,9 @@ static void AddStrBufSimlpeTests(void) case 'U': pTest = CU_add_test(pGroup, "TestUrlescEncodeStdin", TestUrlescEncodeStdin); break; + case 'R': + pTest = CU_add_test(pGroup, "StrBufRFC2047encodeMessageStdin", StrBufRFC2047encodeMessageStdin); + break; default: printf("%c not supported!\n", OutputEscapeAs); CU_ASSERT(1); @@ -433,7 +458,6 @@ int main(int argc, char* argv[]) setvbuf(stdout, NULL, _IONBF, 0); - StartLibCitadel(8); CU_BOOL Run = CU_FALSE ; CU_set_output_filename("TestAutomated");