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.
This commit is contained in:
parent
e55e467d5f
commit
9a31fdcb11
@ -125,7 +125,9 @@ test_contains (cjson_t needle, cjson_t hay)
|
|||||||
}
|
}
|
||||||
if (cjson_is_string (needle))
|
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)
|
if (verbose)
|
||||||
fprintf (stderr, "%s: string mismatch Expected '%s' got '%s'\n",
|
fprintf (stderr, "%s: string mismatch Expected '%s' got '%s'\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user