From nobody Sat Nov 23 17:27:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1723671817615939.2603310532015; Wed, 14 Aug 2024 14:43:37 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 94D1F1347; Wed, 14 Aug 2024 17:43:36 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B388712A8; Wed, 14 Aug 2024 17:43:12 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EAAD11282; Wed, 14 Aug 2024 17:43:09 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 76F94127F for ; Wed, 14 Aug 2024 17:43:09 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-179-z_SLukRaMH-zyYZd_fsHmA-1; Wed, 14 Aug 2024 17:43:07 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E104D1955F03 for ; Wed, 14 Aug 2024 21:43:06 +0000 (UTC) Received: from hjs.brq.redhat.com (unknown [10.43.3.187]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3C3821955E8C for ; Wed, 14 Aug 2024 21:43:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723671789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fE5xm5B6C8Nc39t12rvT8KnNXCQ814TDpWXfpMLInCs=; b=Rp+tSYTdzml+SjAaGM2UG2JIvUWtx0u5TM9XZ9NjWE3EegPApoXYC99fGTjSzxvTabkE1v cK+/Y6/7TOq9VH9IpGrpXqZdZbEv269bZ2espri1sIXJcv9s636VGiJ4hi14oIhNqFf8+G fiSVeGjlEE9UIuHW+nIsHP/xmcqNQ6M= X-MC-Unique: z_SLukRaMH-zyYZd_fsHmA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCH 01/20] tests: json: relax some test cases Date: Wed, 14 Aug 2024 23:40:16 +0200 Message-ID: <8d896f6289a1b7ac7d7e4e46b414156e75e1bc6d.1723671635.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: D4ABEKXBOIHXWYIZIG2FRRXDZACJKQK6 X-Message-ID-Hash: D4ABEKXBOIHXWYIZIG2FRRXDZACJKQK6 X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1723671817944116600 Content-Type: text/plain; charset="utf-8" Some JSON parsers do not like bare types outside of objects or arrays or do validation of object key uniqueness. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tests/virjsontest.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/virjsontest.c b/tests/virjsontest.c index 6b6a64d3d3..efcbbbab98 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -550,9 +550,9 @@ mymain(void) "[\"The meaning of life\"]"); DO_TEST_PARSE_FAIL("unterminated string", "[ \"The meaning of lif ]"); =20 - DO_TEST_PARSE("integer", "1", NULL); - DO_TEST_PARSE("boolean", "true", NULL); - DO_TEST_PARSE("null", "null", NULL); + DO_TEST_PARSE("integer", "[1]", NULL); + DO_TEST_PARSE("boolean", "[true]", NULL); + DO_TEST_PARSE("null", "[null]", NULL); DO_TEST_PARSE("[]", "[]", NULL); =20 DO_TEST_PARSE("escaping symbols", "[\"\\\"\\t\\n\\\\\"]", NULL); @@ -574,14 +574,11 @@ mymain(void) DO_TEST_PARSE_FAIL("array of an object with an array as a key", "[ {[\"key1\", \"key2\"]: \"value\"} ]"); DO_TEST_PARSE_FAIL("object with unterminated key", "{ \"key:7 }"); - DO_TEST_PARSE_FAIL("duplicate key", "{ \"a\": 1, \"a\": 1 }"); =20 DO_TEST_FULL("lookup on array", Lookup, "[ 1 ]", NULL, false); DO_TEST_FULL("lookup on string", Lookup, "\"str\"", NULL, false); - DO_TEST_FULL("lookup on integer", Lookup, - "1", NULL, false); DO_TEST_FULL("lookup with missing key", Lookup, "{ }", NULL, false); DO_TEST_FULL("lookup with wrong type", Lookup, --=20 2.45.2