mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-19 23:43:00 +02:00
Test if a given array has the specified value stored under key. ! does not work here to access the array by variable name. So the solution here is: https://unix.stackexchange.com/questions/60584/how-to-use-a-variable-as-part-of-an-array-name/60585#60585 Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
22 lines
643 B
Bash
Executable File
22 lines
643 B
Bash
Executable File
#!/usr/bin/bash
|
|
|
|
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
|
|
|
|
ROOT="$(readlink -f "${SCRIPT_PATH}/../../../../..")"
|
|
|
|
. ${ROOT}/tests/lib.sh
|
|
|
|
. ${ROOT}/src/initscripts/system/functions
|
|
|
|
# read the date in
|
|
readhash "CONFIG" "${SCRIPT_PATH}/data/1"
|
|
|
|
# test if we read the correct data
|
|
test_that_key_in_arry_has_value "CONFIG" "RED_DHCP_HOSTNAME" "ipfire"
|
|
test_that_key_in_arry_has_value "CONFIG" "BLUE_MACADDR" "bc:30:7d:58:6b:e3"
|
|
|
|
test_that_output_is "${SCRIPT_PATH}/data/1_output_stdout" "1" readhash "CONFIG" "${SCRIPT_PATH}/data/1"
|
|
test_that_output_is "${SCRIPT_PATH}/data/1_output_stderr" "2" readhash "CONFIG" "${SCRIPT_PATH}/data/1"
|
|
|
|
|