On 02/27/2017 05:20 AM, Markus Armbruster wrote: > Pass &error_abort with known-good input. Else pass &err and check > what comes back. This demonstrates that the parser fails silently for > many errors. > > Signed-off-by: Markus Armbruster <[email protected]> > --- > tests/check-qjson.c | 88 > ++++++++++++++++++++++++++++++++++------------------- > 1 file changed, 56 insertions(+), 32 deletions(-) >
> @@ -809,7 +811,7 @@ static void utf8_string(void)
> utf8_in = test_cases[i].utf8_in ?: test_cases[i].utf8_out;
> json_out = test_cases[i].json_out ?: test_cases[i].json_in;
>
> - obj = qobject_from_json(json_in, NULL);
> + obj = qobject_from_json(json_in, utf8_out ? &error_abort : NULL);
This one ignores errors if utf8_out is not specified; intentional?
Especially when compared to...
> static void unterminated_string(void)
> {
> - QObject *obj = qobject_from_json("\"abc", NULL);
> + Error *err = NULL;
> + QObject *obj = qobject_from_json("\"abc", &err);
> + g_assert(!err); /* BUG */
> g_assert(obj == NULL);
change like these.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
