From patchwork Mon May 20 09:06:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 7793 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 4VjWsk1cjYz3wxG for ; Mon, 20 May 2024 09:07:06 +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 4VjWsJ5x7Nz5nX; Mon, 20 May 2024 09:06:44 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4VjWsC0Twsz32xd; Mon, 20 May 2024 09:06:39 +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 4VjWs61kGhz2y2N for ; Mon, 20 May 2024 09:06:34 +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 4VjWs60FwXz5gZ; Mon, 20 May 2024 09:06:34 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1716195994; 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=1MfYgFu3R7m99FRB/IhbCZ/LsnAPiSQDA9IWq9R/wy4=; b=zeqzlD3Api9karDw2YFHblITRhxdptFwAqG4JFplqCRNVuvVJwc7/Ykx7OoqmYWz5Y7cy3 YVPG0TQ0wJwLk4Cw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1716195994; 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=1MfYgFu3R7m99FRB/IhbCZ/LsnAPiSQDA9IWq9R/wy4=; b=byIeNShfqkZjPJ5iflNjXmmKnk11s+BhBm/A+0unyG0rvOUtTAkJIcKvqKZIYPzHaYHiy9 1nzLt+apzpcZAoSM5zh8A5G6C2oAAkSWwHLwfx5qQIdtGHiCusxIJ9rgUv9SJJ+GOJw3So 2+doXoPrcFS4AprFnwLAvYmW9VphQJ4BhLNve8TCAFlZiWpan9QGwwgQL4QNpVXZ/gT47H R0IIBWLtW1kfdKIgMtavb3jG5PcysIofmf7pONJ/0y8DWnNjzVrb3w4bH0Ob2QBFlyf9Wm p89u3zu8wUPSwJ28incWtJVi4OTvj/rFlhQajQ7qMLbmPxH0vRekmqVbpqq8pQ== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [PATCH 10/21] test_that_key_in_arry_has_value: Check if a key in an array exists Date: Mon, 20 May 2024 11:06:00 +0200 Message-Id: <20240520090611.10406-11-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: 3DRWKOQYJDAGRCVW5QJ7ZQ56TNX6VUC3 X-Message-ID-Hash: 3DRWKOQYJDAGRCVW5QJ7ZQ56TNX6VUC3 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/lib.sh b/tests/lib.sh index ad7c12cb0..81bc1439c 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -38,7 +38,8 @@ test_that_key_in_arry_has_value() { return 1 fi - if [[ ! -v "${array[${key}]}" ]]; then + + if [[ "${array["${key}"]+_}" == "" ]]; then log_test_failed "The array does not contain the key '${key}', valid keys are: ${!array[*]}" return 1 fi