On 20 May 2024, at 10:05, Jonatan Schlag jonatan.schlag@ipfire.org wrote:
-v does a bad job here. We need to use declare here.
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org
tests/lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/lib.sh b/tests/lib.sh index 079755410..0f4de8e43 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -29,10 +29,11 @@ var_has_value() {
test_that_key_in_arry_has_value() { local array="${!1}"
- local arrayname="${1}"
local key="${2}" local value="${3}"
- if [[ ! -v "${array}" ]]; then
- if [[ ! "$(declare -p "${arrayname}")" =~ "declare -a" && ! "$(declare -p "${arrayname}")" =~ "declare -A" ]]; then
log_test_failed "The array '${1}' does not exists. The variable is not set." return 1
Please comment code like this. It is hard to read and not obvious to understand.
fi
2.39.2