shelllings |
git clone https://git.davidvoz.net/shelllings.git
|
| 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | RED="\033[31m" |
| 5 | GREEN="\033[32m" |
| 6 | RESET="\033[0m" |
| 7 | |
| 8 | failed() { |
| 9 | printf "${RED}Failed${RESET}\n" |
| 10 | exit 1 |
| 11 | } |
| 12 | |
| 13 | cleanup() { |
| 14 | [ -d 06_folder ] && rm -rf 06_folder |
| 15 | } |
| 16 | trap cleanup EXIT |
| 17 | |
| 18 | |
| 19 | sh exercises/06_removing.sh |
| 20 | |
| 21 | [ "$(wc -l < exercises/06_removing.sh)" -eq 44 ] || { |
| 22 | failed |
| 23 | echo "not 27 lines" |
| 24 | } |
| 25 | |
| 26 | [ -d "06_folder" ] || failed |
| 27 | |
| 28 | [ "$(ls -A 06_folder | wc -l)" -eq 0 ] || failed |
| 29 | |
| 30 | printf "${GREEN}Passed${RESET}\n" |