Commit 89d3524d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Test cases for convert_xml_special_chars

parent 69d28e6f
...@@ -44,6 +44,21 @@ static void decode (const char *in, const char *out) ...@@ -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) int main (void)
{ {
(void)setvbuf (stdout, NULL, _IONBF, 0); (void)setvbuf (stdout, NULL, _IONBF, 0);
...@@ -59,5 +74,8 @@ int main (void) ...@@ -59,5 +74,8 @@ int main (void)
decode ("&<\"'", "&<\"'"); decode ("&<\"'", "&<\"'");
decode ("&oelig", "&oelig"); decode ("&oelig", "&oelig");
encode ("", "");
encode ("a'àc\"çe&én<ño>ö1:", "a&#39;àc&quot;çe&amp;én&lt;ño&gt;ö1:");
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment