From: Rémi Denis-Courmont Date: Wed, 15 Jul 2009 18:36:23 +0000 (+0300) Subject: Test cases for convert_xml_special_chars X-Git-Tag: 1.1.0-ff~4966 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=89d3524d62e93343ff6d5e963ecaeb042c143f4b;p=vlc Test cases for convert_xml_special_chars --- diff --git a/src/test/xmlent.c b/src/test/xmlent.c index acba7180eb..e5bc4a6eb7 100644 --- a/src/test/xmlent.c +++ b/src/test/xmlent.c @@ -44,6 +44,21 @@ static void decode (const char *in, const char *out) } } +static void encode (const char *in, const char *out) +{ + char *buf; + + printf ("\"%s\" -> \"%s\" ?\n", in, out); + buf = convert_xml_special_chars (in); + + if (strcmp (buf, out)) + { + printf (" ERROR: got \"%s\"\n", buf); + exit (2); + } + free (buf); +} + int main (void) { (void)setvbuf (stdout, NULL, _IONBF, 0); @@ -59,5 +74,8 @@ int main (void) decode ("&<\"'", "&<\"'"); decode ("&oelig", "&oelig"); + encode ("", ""); + encode ("a'àc\"çe&én<ño>ö1:", "a'àc"çe&én<ño>ö1:"); + return 0; }