mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 07:50:00 +00:00
Patch/test scripts now run from project root
This simplifies everything and makes everything good. (Shell scripts need to be as simple as possible for maximum compatibility.)
This commit is contained in:
@@ -6,18 +6,23 @@
|
||||
# Gollum, The Hobbit, or There and Back Again
|
||||
#
|
||||
|
||||
cd $(dirname $(realpath $0))
|
||||
f=$(basename ../exercises/$1*.zig .zig 2> /dev/null)
|
||||
b=../exercises/$f.zig
|
||||
a=../answers/$f.zig
|
||||
p=patches/$f.patch
|
||||
if [ ! -f 'patches/gollum.sh' ]
|
||||
then
|
||||
echo "We must be run from the project root dir, precious!"; exit 1
|
||||
fi
|
||||
|
||||
printf "\tf: '$f'\n\tb: '$b'\n\ta: '$a'\n"
|
||||
ex=$(printf "%03d" $1)
|
||||
echo "Nassssty exercise $ex..."
|
||||
|
||||
if [ ! -f $b ]; then echo "We hates it!"; exit 1; fi
|
||||
if [ ! -f $a ]; then echo "Where is it? Where is the answer, precious?"; exit; fi
|
||||
f=$(basename exercises/${ex}_*.zig .zig 2> /dev/null)
|
||||
b=exercises/$f.zig
|
||||
a=answers/$f.zig
|
||||
p=patches/patches/$f.patch
|
||||
|
||||
echo Hisssss!
|
||||
if [ ! -f $b ]; then echo "No $f! We hates it!"; exit 1; fi
|
||||
if [ ! -f $a ]; then echo "No $a! Where is it? Where is the answer, precious?"; exit; fi
|
||||
|
||||
echo "Hissss!\tbefore: '$b'\n\t after: '$a'\n\t patch: '$p'\n"
|
||||
|
||||
diff $b $a > $p
|
||||
|
||||
|
||||
Reference in New Issue
Block a user