summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes7
-rw-r--r--.github/workflows/ci.yml18
-rw-r--r--.github/workflows/eowyn.yml2
-rw-r--r--.gitignore9
-rw-r--r--exercises/099_formatting.zig2
-rwxr-xr-xpatches/eowyn.sh26
6 files changed, 40 insertions, 24 deletions
diff --git a/.gitattributes b/.gitattributes
index 97386d9..1cb5af7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4,13 +4,6 @@
# Default behavior, if core.autocrlf is unset.
* text=auto
-# Files to be converted to native line endings on checkout.
-*.cpp text
-*.h text
-
-# Text files to always have CRLF (dos) line endings on checkout.
-*.bat text eol=crlf
-
# Text files to always have LF (unix) line endings on checkout.
*.sh text eol=lf
*.zig text eol=lf
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ebeda5b..57e8225 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,7 +14,7 @@ jobs:
matrix:
zig: [ 0.6.0, 0.7.0, 0.8.0, 0.9.0, 0.10.0 ]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
@@ -23,3 +23,19 @@ jobs:
- name: Check compatibility with old Zig compilers
run: ci/compat.sh
+ test:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 60
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Zig
+ uses: goto-bus-stop/setup-zig@v2
+ with:
+ version: master
+
+ - name: Unit Test
+ run: zig build test
diff --git a/.github/workflows/eowyn.yml b/.github/workflows/eowyn.yml
index a7133ca..cfa84a4 100644
--- a/.github/workflows/eowyn.yml
+++ b/.github/workflows/eowyn.yml
@@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
diff --git a/.gitignore b/.gitignore
index eeb5eef..4dc8b36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
-*~
-*.swp
-zig-cache/
-answers/
-patches/healed/
+/zig-cache/
+/zig-out/
+/answers/
+/patches/healed/
diff --git a/exercises/099_formatting.zig b/exercises/099_formatting.zig
index 074358b..fc73338 100644
--- a/exercises/099_formatting.zig
+++ b/exercises/099_formatting.zig
@@ -82,7 +82,7 @@
//
// X | 1 2 3 4 5 ...
// ---+---+---+---+---+---+
-// 1 | 1 2 3 4 5
+// 1 | 1 2 3 4 5
//
// 2 | 2 4 6 8 10
//
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