summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rwxr-xr-xpatches/eowyn.sh26
1 files changed, 17 insertions, 9 deletions
diff --git a/patches/eowyn.sh b/patches/eowyn.sh
index a036acf..bc2fb7c 100755
--- a/patches/eowyn.sh
+++ b/patches/eowyn.sh
@@ -12,14 +12,18 @@
# using the patches in this directory and convey them
# to convalesce in the healed directory.
#
+set -e
# We check ourselves before we wreck ourselves.
-if [ ! -f 'patches/eowyn.sh' ]
+if [ ! -f patches/eowyn.sh ]
then
echo "But I must be run from the project root directory."
exit 1
fi
+# Which version we have?
+echo "I am in version 23.4.25.1, let's try our magic power."
+
# Create directory of healing if it doesn't already exist.
mkdir -p patches/healed
@@ -27,23 +31,27 @@ mkdir -p patches/healed
for broken in exercises/*.zig
do
# Remove the dir and extension, rendering the True Name.
- true_name=$(basename $broken .zig)
+ true_name=$(basename "$broken" .zig)
patch_name="patches/patches/$true_name.patch"
-
- if [ -f $patch_name ]
+ if [ -f "$patch_name" ]
then
# Apply the bandages to the wounds, grow new limbs, let
# new life spring into the broken bodies of the fallen.
- echo Healing $true_name...
- patch --output=patches/healed/$true_name.zig $broken $patch_name
+ echo Healing "$true_name"...
+ patch --output="patches/healed/$true_name.zig" "$broken" "$patch_name"
else
- echo Cannot heal $true_name. No patch found.
+ echo Cannot heal "$true_name". No patch found.
fi
done
-# Check the healed exercises formatting.
-zig fmt --check patches/healed
+# Test the correct formatting of the healed exercises.
+echo "Looking for non-conforming code formatting..."
+for healed in patches/healed/*.zig
+do
+ echo Check $(basename "$healed")
+ zig fmt --check "$healed"
+done
# Test the healed exercises. May the compiler have mercy upon us.
zig build -Dhealed