Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin(run-tests): assume that zig is found #303

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions bin/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
set -eo pipefail

execute_test() {
local zig_path="${2}"
(
cd "${1}"
# Get the exercise name from the directory
Expand All @@ -15,7 +14,7 @@ execute_test() {
if [[ -f "./.meta/example.zig" ]]; then
mv ./.meta/example.zig "${exercise_name}".zig
# No building required, just test it
"${zig_path}" test "test_${exercise_name}.zig"
zig test "test_${exercise_name}.zig"
printf '\n'
else
printf '%s\n' "${exercise_name} missing contents, skipping test..."
Expand All @@ -39,14 +38,6 @@ main() {

cp -r exercises/practice build

if [ -L "${HOME}/bin/zig" ]; then
# Zig track repo symlinks zig to this location
local zig_path="${HOME}/bin/zig"
else
# Otherwise zig should be on your $PATH
local zig_path='zig'
fi

(
cd build/

Expand All @@ -64,7 +55,7 @@ main() {
fi

for exercise in "${exercises[@]}"; do
execute_test "${exercise}" "${zig_path}"
execute_test "${exercise}"
done
)

Expand Down