On 20 May 2024, at 10:05, Jonatan Schlag jonatan.schlag@ipfire.org wrote:
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org
tests/lib.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tests/lib.sh b/tests/lib.sh index c51257e79..373b7c3a0 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -24,6 +24,11 @@ test_that_key_in_arry_has_value() { local key="${2}" local value="${3}"
- if [[ ! -v "${array}" ]]; then
- echo -e "${CLR_RED_BG}Test failed: The array '${1}' does not exists. The variable is not set.${CLR_RESET}'"
Typo.
You never want to use double brackets unless you have something that [ does not understand. As far as I know this is only regular expressions.
- return 1
- fi
if [[ "${array[${key}]}" == "${value}" ]] ; then echo -e "${CLR_GREEN_BG}Test succeded: The array '${1}' contains the value '${value}' under the key '${key}' ${CLR_RESET}" return 0 -- 2.39.2