seed: curriculum content
This commit is contained in:
20
1.solar-system/1.welcome/13.the-saver/testing/test.sh
Normal file
20
1.solar-system/1.welcome/13.the-saver/testing/test.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
git init -q -b main
|
||||
git config user.name "Setup"
|
||||
git config user.email "setup@learnroom.local"
|
||||
|
||||
bash solution.sh > /dev/null 2>&1
|
||||
|
||||
N=0
|
||||
report() { N=$((N+1)); if [ "$1" = "0" ]; then echo "ok $N - $2"; else echo "not ok $N - $2"; fi; }
|
||||
|
||||
{ [ -f a.txt ] && grep -q alpha a.txt 2>/dev/null; }; report $? "a.txt exists with 'alpha'"
|
||||
{ [ -f b.txt ] && grep -q beta b.txt 2>/dev/null; }; report $? "b.txt exists with 'beta'"
|
||||
{ [ -f c.txt ] && grep -q gamma c.txt 2>/dev/null; }; report $? "c.txt exists with 'gamma'"
|
||||
|
||||
COUNT=$(git log --oneline 2>/dev/null | wc -l | tr -d ' ')
|
||||
[ "$COUNT" = "3" ]; report $? "exactly 3 commits in git log"
|
||||
|
||||
MSGS=$(git log --reverse --format='%s' 2>/dev/null)
|
||||
EXPECTED=$'add alpha\nadd beta\nadd gamma'
|
||||
[ "$MSGS" = "$EXPECTED" ]; report $? "commit messages: 'add alpha', 'add beta', 'add gamma' in order"
|
||||
Reference in New Issue
Block a user