fca165b274
* Created _ansi function library to set terminal properties like cursor position and text color. * Created _if function library, a set of simple if statements. Added _if_array_contains, _if_is_integer, _if_is defined, if_has_value
26 lines
530 B
Bash
26 lines
530 B
Bash
#!/bin/bash
|
|
|
|
source "../lib/if.sh"
|
|
|
|
echo "_if_array_contains test started"
|
|
for result in 2 2 0 1; do
|
|
echo "Exit code should be ${result}"
|
|
eArray=(aa ab 0 dsa 2)
|
|
i=${result}
|
|
_if_array_contains "${i}" "${eArray[@]}"
|
|
echo $?
|
|
done
|
|
echo "_if_array_contains test ended"
|
|
|
|
echo "_if_is_integer test started"
|
|
for result in 0 1; do
|
|
echo "Exit code should be ${result}"
|
|
if [ ${result} == 0 ]; then
|
|
i=0
|
|
else
|
|
i=a
|
|
fi
|
|
_if_is_integer ${i}
|
|
echo $?
|
|
done
|
|
echo "_if_is_integer test ended"
|