diff options
author | Michael Zucci <zucchi@src.gnome.org> | 2000-11-24 15:06:45 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-11-24 15:06:45 +0800 |
commit | 05aaadc66b77c9f080b590fa19938de8ec80691d (patch) | |
tree | 29a0a25e2261139de414e4a6172e678fafa4322b /camel/tests/message | |
parent | 189cb50426fc12b55a79c67a00064623ec964383 (diff) | |
download | gsoc2013-evolution-05aaadc66b77c9f080b590fa19938de8ec80691d.tar.gz gsoc2013-evolution-05aaadc66b77c9f080b590fa19938de8ec80691d.tar.zst gsoc2013-evolution-05aaadc66b77c9f080b590fa19938de8ec80691d.zip |
little util to scan mailboxes for any and every address they contain.
* tests/data/getaddr.pl: little util to scan mailboxes for any and
every address they contain.
* tests/message/test2.c (main): Added a bunch of stuff to test
decoding/reencoding/etc of internationalised addresses.
* tests/message/lib/address-data.h: Copy of some unicode/other
testing data. **Beware** of editing this file in emacs, it'll
probably try and convert all the characters to something
unusable.
* tests/lib/camel-test.c (camel_test_break): Add a debugger hook
point.
* camel-mime-utils.c (quoted_encode): Check for space and convert
to _ separately.
(header_decode_mailbox): Fixed the 'check comments for realname'
code, problem was the domain getting code was skipping all
whitespace/comments before we could get a look-in. This is
approximate but fairly robust.
(header_decode_text): Dont use the c-type isspace func here, we
want a specific whitespace only.
(header_decode_text): If we have decoded words next to each other,
do not insert whitespaces between them, which is what rfc2047 requires.
(header_decode_text): Make c unsigned too.
svn path=/trunk/; revision=6658
Diffstat (limited to 'camel/tests/message')
-rw-r--r-- | camel/tests/message/test2.c | 78 |
1 files changed, 32 insertions, 46 deletions
diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c index 8a3fe3c250..00bd6aabf2 100644 --- a/camel/tests/message/test2.c +++ b/camel/tests/message/test2.c @@ -11,51 +11,7 @@ #include <camel/camel-internet-address.h> #include <camel/camel-address.h> -/* a bunch of test strings in different encodings, just taken from gnome-core po files */ -/* see data/genline.pl */ -struct _l { - char *type; - char *line; -} test_lines[] = { - /* FIXME: for now, remove the types libunicode doesn't know about, this is tricky to fix */ - /* And at best, all we could do is translate it to X-Unknown, or something */ - /*{ "windows-1251", "Åäèí àïëåò íå îòãîâàðÿ íà çàÿâêà çà çàïèñ.\nÄà ãî ïðåìàõíà ëè èëè äà ïî÷àêàì?" },*/ - { "iso-8859-1", "Omple les miniatures de la finestra amb contingut de la pantalla" }, - { "ISO-8859-2", "Správce oken hýbe s okrajem okna (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "ISO-8859-1", "Vindueshåndtering flytter dekorationsvindue istedet (AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "ISO-8859-1", "Vorschaubilder der Fenster mit dem Bildschirminhalt ausfüllen" }, - { "iso-8859-7", "ÅìöÜíéóç åñãáóéþí ðïõ äå öáßíïíôáé óôç ëßóôá ðáñáèýñùí (ÐÁÑÁÊÁÌØÇ-ËÉÓÔÁÐÁÑÁÈÕÑÙÍ)" }, - { "iso-8859-1", "You've chosen to disable the startup hint. To re-enable it, choose \"Startup Hint\" in the GNOME Control Centre" }, - { "iso-8859-1", "El aplique de reloj muestra en su panel la fecha y la hora de forma simple y ligero " }, - { "iso-8859-1", "Applet ei vasta salvestuskäsule. Kas peaks ta niisama sulgema, või veel ootama?" }, - { "iso-8859-1", "Lehio kudeatzaileak lehioaren dekorazaioa mugiarazten (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-15", "Näytä sovellukset, joiden ikkunoista on näkyvillä vain otsikkopalkki" }, - { "ISO-8859-1", "Afficher les tâches qui ne sont pas dans la liste des fenêtres" }, - { "iso-8859-1", "Níl applet ag tabhair freagra ar iarratas sábháil. Bain amach an applet nó lean ar fánacht?" }, - { "iso-8859-1", "Amosa-las tarefas agochadas da lista de fiestras (SKIP-WINLIST)" }, - { "iso-8859-2", "Az ablakkezelõ a dekorációt mozgassa az ablak helyett (AfterStep, Enlightenment, FVWM, IceWM, SawMill)" }, - { "iso-8859-1", "Riempi la finestra delle anteprime con il contenuto dello schermo" }, - { "euc-jp", "¥¦¥¤¥ó¥É¥¦¥Þ¥Í¡¼¥¸¥ã¤Ï¾þ¤ê¥¦¥¤¥ó¥É¥¦¤òÆ°¤«¤¹ (AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "euc-kr", "â °ü¸®ÀÚ°¡ ²Ù¹Î â ´ë½Å À̵¿ (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-13", "Priedas neatsakinëja á praðymà iðsisaugoti. Paðalinti priedà ar laukti toliau?" }, - { "iso-8859-1", "Window manager verplaatst dekoratie (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-1", "Vindushåndtereren flytter dekorasjonsvinduet i stedet (AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-2", "Przemieszczanie dekoracji zamiast okna (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-1", "Este programa é responsável por executar outras aplicações, embeber pequenos applets, a paz no mundo e crashes aleatórios do X." }, - { "iso-8859-1", "Mostrar tarefas que se escondem da lista de janelas (SKIP-WINLIST)" }, - { "koi8-r", "÷ÙÓÏÔÁ ÒÁÂÏÞÅÇÏ ÓÔÏÌÁ × ÐÅÒÅËÌÀÞÁÔÅÌÅ ÓÏ×ÐÁÄÁÅÔ Ó ×ÙÓÏÔÏÊ ÐÁÎÅÌÉ" }, - { "iso-8859-2", "Správca okien presúva okraje okien (AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-2", "Ka¾i posle, ki se skrivajo pred upravljalnik oken (SKIP-WINLIST)" }, - { "iso-8859-5", "Window ÜÕÝÐÔ×ÕàØ ßÞÜÕàÐ ÔÕÚÞàÐæØÞÝØ ßàÞ×Þà ãÜÕáâÞ âÞÓa (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-2", "Window menadzeri pomera dekoracioni prozor umesto toga (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-1", "Fönsterhanteraren flyttar dekorationsfönstret istället (AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - /*{ "TSCII", "À½¢ì¸¼î-ºð¼¸ò¾¢ø À¡÷ì¸ ÓÊ¡¾ À½¢ì¸¼í¸¨Ç ¸¡Á¢ (À½¢ì¸¼î-ºð¼¸õ-¾Å¢÷)" },*/ - { "iso-8859-9", "Kaydetme isteðine bir uygulak cevap vermiyor . Uygulaðý sileyim mi , yoksa bekleyeyim mi ?" }, - { "koi8-u", "ðÅÒÅͦÝÅÎÎÑ ÄÅËÏÒÁæ§ ÚÁͦÓÔØ ×¦ËÎÁ (AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-1", "Cwand on scriftôr est bodjî foû, li scriftôr èt totes les apliketes å dvins sont pierdowes. Bodjî ci scriftôr chal?" }, - { "gb2312", "ǨÒƵ½×°Êδ°¿Ú¹ÜÀí³ÌÐò(AfterStep, Enlightenment, FVWM, IceWM, SawMill)" }, - { "big5", "µøµ¡ºÞ²zªÌ¥u²¾°Ê¸Ë¹¢µøµ¡ (AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, -}; +#include "address-data.h" static char *convert(const char *in, const char *from, const char *to) { @@ -330,8 +286,38 @@ int main(int argc, char **argv) camel_test_end(); - /* FIXME: Add test of decoding of externally defined addresses */ + camel_test_start("CamelInternetAddress, I18N decode"); + + for (i=0;i<ARRAY_LEN(test_address);i++) { + push("Testing address line %d '%s'", i, test_address[i].addr); + + addr = camel_internet_address_new(); + push("checking decoded"); + check(camel_address_decode(CAMEL_ADDRESS(addr), test_address[i].addr) == test_address[i].count); + format = camel_address_format(CAMEL_ADDRESS(addr)); + check(strcmp(format, test_address[i].utf8) == 0); + test_free(format); + pull(); + + push("Comparing re-encoded output"); + addr2 = CAMEL_INTERNET_ADDRESS(camel_internet_address_new()); + enc = camel_address_encode(CAMEL_ADDRESS(addr)); + check_msg(camel_address_decode(CAMEL_ADDRESS(addr2), enc) == test_address[i].count, "enc = '%s'", enc); + test_free(enc); + test_address_compare(addr, addr2); + check_unref(addr2, 1); + pull(); + + check_unref(addr, 1); + + pull(); + } + + camel_test_end(); + /* FIXME: Add test of decoding of broken addresses */ return 0; } + + |