From patchwork Mon May 20 09:05:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 7796 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4VjWsl4VTxz3wxb for ; Mon, 20 May 2024 09:07:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4VjWsD3wdhz5mp; Mon, 20 May 2024 09:06:40 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4VjWs940vsz32W4; Mon, 20 May 2024 09:06:37 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4VjWs45MZVz336n for ; Mon, 20 May 2024 09:06:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4VjWs446F8zXy; Mon, 20 May 2024 09:06:32 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1716195992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IQ/Q9zie4WzrX6Gq+BJ5PDVlpD/BiLh6rOaudaSgPZU=; b=ZT5AHZcVWSnzHUZWzrsRFPWpMHIqG1BeVbuYEuxsHsOTGy5LuZ2Orb3fWKmcXLh4NLxyO3 ZjNXSG0MKoKRRQBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1716195992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IQ/Q9zie4WzrX6Gq+BJ5PDVlpD/BiLh6rOaudaSgPZU=; b=AAo+dor8lw5FHztszGZHlmtla9jgALwUpeiV/JAfTDqZEROQlbK1+tu1XJCaC4JPqaR2xX KIalBOrbJX9acFTYHKBlbHUWi20aQjz9lj5T+c4SybuxmBFCR1ftHh3ZWEpNUrpmY8C0K/ l6z9zQIp8MqBEWj5+mh3vynz8auLo5aFY7rVvS3KBjTEGTRq70p+BgnZVLMpDn7S86uRzx np/VKLtl60hwN+GrM5+qYHNsYAbhh25pVNqMk/EXMjDnxbwSrwc3OeNW7ESSmOPnXTDCl6 AH1OQHNEpdDyjS0vnGmMptCT9Y7ESBRZ+jNMvsV9If1TSct6syNF0Hgcse8Pdg== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [PATCH 08/21] test_that_key_in_arry_has_value: Check if the key is defined Date: Mon, 20 May 2024 11:05:58 +0200 Message-Id: <20240520090611.10406-9-jonatan.schlag@ipfire.org> In-Reply-To: <20240520090611.10406-1-jonatan.schlag@ipfire.org> References: <20240520090611.10406-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 5TO7GSIDFKOEPJ37LNLS6LZ7NGWILJWW X-Message-ID-Hash: 5TO7GSIDFKOEPJ37LNLS6LZ7NGWILJWW X-MailFrom: jonatan.schlag@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Jonatan Schlag --- tests/lib.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/lib.sh b/tests/lib.sh index 0f4de8e43..006862da6 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -38,6 +38,11 @@ test_that_key_in_arry_has_value() { return 1 fi + if [[ ! -v "${array[${key}]}" ]]; then + log_test_failed "The array does not contain the key '${key}', valid keys are: ${!array[*]}" + return 1 + fi + if [[ "${array[${key}]}" == "${value}" ]] ; then log_test_succeded "The array '${1}' contains the value '${value}' under the key '${key}'" return 0