This repository has been archived on 2024-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
bunc/test/test-if.sh
ayakael fca165b274
* Changed name for _log function to _msg, added bail() function.
* 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
2018-01-06 20:30:09 -09:00

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"