]> git.sesse.net Git - vlc/commitdiff
Test cases for convert_xml_special_chars
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 15 Jul 2009 18:36:23 +0000 (21:36 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 15 Jul 2009 18:36:23 +0000 (21:36 +0300)
src/test/xmlent.c

index acba7180ebbdb68f34af4f65423e9c2cdb20d7f3..e5bc4a6eb73c04cf907133c111d23edc566a9e14 100644 (file)
@@ -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&#39;àc&quot;çe&amp;én&lt;ño&gt;ö1:");
+
     return 0;
 }