Files
curriculum/1.solar-system/1.welcome/05.the-mover/testing/test.sh

26 lines
1.0 KiB
Bash

#!/bin/bash
mkdir -p cargo/food cargo/water cargo/tools inbox
touch cargo/food/manifest.txt cargo/water/manifest.txt cargo/tools/manifest.txt
echo "1 apple" > inbox/food-apple.txt
echo "1 loaf" > inbox/food-bread.txt
echo "500ml" > inbox/water-bottle.txt
echo "1L" > inbox/water-canteen.txt
echo "10mm" > inbox/tool-wrench.txt
echo "claw" > inbox/tool-hammer.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 '[ -f cargo/food/food-apple.txt ]' "food-apple in cargo/food"
check '[ -f cargo/food/food-bread.txt ]' "food-bread in cargo/food"
check '[ -f cargo/water/water-bottle.txt ]' "water-bottle in cargo/water"
check '[ -f cargo/water/water-canteen.txt ]' "water-canteen in cargo/water"
check '[ -f cargo/tools/tool-wrench.txt ]' "tool-wrench in cargo/tools"
check '[ -f cargo/tools/tool-hammer.txt ]' "tool-hammer in cargo/tools"
check '[ -f cargo/food/manifest.backup ]' "cargo/food/manifest.backup exists"