On 20 May 2024, at 10:05, Jonatan Schlag jonatan.schlag@ipfire.org wrote:
I think the name says it all.
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org
tests/lib.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/tests/lib.sh b/tests/lib.sh index 7749d5158..c51257e79 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -18,3 +18,17 @@ test_that() { var_has_value() { [[ "${!1}" == "${2}" ]] }
+test_that_key_in_arry_has_value() {
This is again very long and has a typo.
- local array="${!1}"
- local key="${2}"
- local value="${3}"
- 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
- else
- echo -e "${CLR_RED_BG}Test failed: The array '${1}' contains the value '${array[${key}]}' under the key '${key} and not '${value}' ${CLR_RESET}"
- return 1
- fi
+}
2.39.2