qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 14/24] check-qjson: Test errors from qobject_fro


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 14/24] check-qjson: Test errors from qobject_from_json()
Date: Tue, 28 Feb 2017 13:25:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

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 <address@hidden>
> ---
>  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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]