aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2018-11-14 13:57:40 +0000
committerAndre Heinecke <[email protected]>2018-11-14 13:57:40 +0000
commit9a31fdcb11d04d47dfcc38a8409b84436c549108 (patch)
tree19c1880c2acdb73821bfadbf37db6e1ebce0b869
parenttests,json: Skip tests for older GnuPG versions (diff)
downloadgpgme-9a31fdcb11d04d47dfcc38a8409b84436c549108.tar.gz
gpgme-9a31fdcb11d04d47dfcc38a8409b84436c549108.zip
tests,json: Add wildcard string matching
* tests/json/t-json.c (test_contains): When searching for "*" accept every string. -- This allows it to write tests that check for the existence of a string value but don't care about the contents. E.g. for Data.
-rw-r--r--tests/json/t-json.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/json/t-json.c b/tests/json/t-json.c
index 07b99847..f5b27939 100644
--- a/tests/json/t-json.c
+++ b/tests/json/t-json.c
@@ -125,7 +125,9 @@ test_contains (cjson_t needle, cjson_t hay)
}
if (cjson_is_string (needle))
{
- if (strcmp (needle->valuestring, hay->valuestring))
+ if (strcmp (needle->valuestring, hay->valuestring) &&
+ /* Use * as a general don't care placeholder */
+ strcmp (needle->valuestring, "*"))
{
if (verbose)
fprintf (stderr, "%s: string mismatch Expected '%s' got '%s'\n",