2023-03-09 12:14:37 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-04-21 15:05:48 +02:00
|
|
|
# Runs unit tests and reports coverage percentage.
|
2023-03-09 12:14:37 +01:00
|
|
|
|
2023-04-21 15:05:48 +02:00
|
|
|
source "$(dirname $(realpath $0))/util.sh"
|
2023-03-09 12:14:37 +01:00
|
|
|
|
2023-04-21 15:05:48 +02:00
|
|
|
echo 'Running unit tests...'
|
|
|
|
coverage run
|
|
|
|
typeset percentage
|
|
|
|
typeset color
|
|
|
|
percentage="$(coverage report | awk '$1 == "TOTAL" {print $NF; exit}')"
|
|
|
|
[[ $percentage == "100%" ]] && color="${bold_green}" || color="${yellow}"
|
|
|
|
echo -e "${color}${percentage} coverage${color_reset}\n"
|