aboutsummaryrefslogtreecommitdiffstats
path: root/common/t-percent.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-04-01 10:51:53 +0000
committerWerner Koch <[email protected]>2009-04-01 10:51:53 +0000
commitf8b4cd76501824d56d3cf78a8ba85291a62f0e6d (patch)
treecec902ba7d3dd1a38846805cf491a65b95bb79cd /common/t-percent.c
parentImplement decryption for TCOS 3 cards. (diff)
downloadgnupg-f8b4cd76501824d56d3cf78a8ba85291a62f0e6d.tar.gz
gnupg-f8b4cd76501824d56d3cf78a8ba85291a62f0e6d.zip
Import/export of pkcs#12 now uses the gpg-agent directly.
Removed duplicated code (percent unescaping).
Diffstat (limited to 'common/t-percent.c')
-rw-r--r--common/t-percent.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/common/t-percent.c b/common/t-percent.c
index 93d95f78d..b8641b90b 100644
--- a/common/t-percent.c
+++ b/common/t-percent.c
@@ -66,8 +66,9 @@ test_percent_plus_escape (void)
"%0A+ABC%09"
}, { NULL, NULL }
};
- char *buf;
+ char *buf, *buf2;
int i;
+ size_t len;
for (i=0; tbl[i].string; i++)
{
@@ -79,17 +80,34 @@ test_percent_plus_escape (void)
}
if (strcmp (buf, tbl[i].expect))
fail (i);
+ buf2 = percent_plus_unescape (buf, 0);
+ if (!buf2)
+ {
+ fprintf (stderr, "out of core: %s\n", strerror (errno));
+ exit (2);
+ }
+ if (strcmp (buf2, tbl[i].string))
+ fail (i);
+ xfree (buf2);
+ /* Now test the inplace conversion. */
+ len = percent_plus_unescape_inplace (buf, 0);
+ buf[len] = 0;
+ if (strcmp (buf, tbl[i].string))
+ fail (i);
xfree (buf);
}
}
+
int
main (int argc, char **argv)
{
(void)argc;
(void)argv;
+ /* FIXME: We escape_unescape is not tested - only
+ percent_plus_unescape. */
test_percent_plus_escape ();
return 0;