Files
curriculum/1.solar-system/1.welcome/04.the-maker/testing/test.sh

18 lines
749 B
Bash

#!/bin/bash
echo "stale entry" > cargo-old.txt
bash solution.sh > /dev/null 2>&1
N=0
check() {
N=$((N+1))
if eval "$1"; then echo "ok $N - $2"; else echo "not ok $N - $2"; fi
}
check '[ -d cargo/food ]' "cargo/food exists"
check '[ -d cargo/water ]' "cargo/water exists"
check '[ -d cargo/tools ]' "cargo/tools exists"
check '[ -f cargo/food/manifest.txt ] && [ ! -s cargo/food/manifest.txt ]' "cargo/food/manifest.txt exists and is empty"
check '[ -f cargo/water/manifest.txt ] && [ ! -s cargo/water/manifest.txt ]' "cargo/water/manifest.txt exists and is empty"
check '[ -f cargo/tools/manifest.txt ] && [ ! -s cargo/tools/manifest.txt ]' "cargo/tools/manifest.txt exists and is empty"
check '[ ! -f cargo-old.txt ]' "cargo-old.txt removed"