add unit tests to test action and separate unit_tests.sh from test_all.sh
All checks were successful
/ test (push) Successful in 43s

This commit is contained in:
Neemek 2025-09-16 20:08:20 +02:00
parent dac2cbc20d
commit bcf0978b68
3 changed files with 29 additions and 24 deletions

View file

@ -21,3 +21,5 @@ jobs:
- name: Test Core - name: Test Core
working-directory: ./core working-directory: ./core
run: go test run: go test
- name: Run Unit Tests
run: bash unit_tests.sh

View file

@ -20,27 +20,4 @@ else
fi fi
cd .. cd ..
errors=() bash ./unit_tests.sh
echo '=== Testing anglais ==='
# read files
for file in $(find tests -type f); do
echo "-v- Test-running file $file -v-"
if ! ./cli/cli run "$file"; then
echo "-x- Error -x-"
errors+=("$file")
else
echo "-+- Success -+-"
fi
done
if [ 0 -ne "$(wc -w <<< "${errors[@]}")" ]; then
echo "=x= Errors occured while executing =x="
echo "erroring files: $(printf '%s ' "${errors[@]}")"
exit 1
else
echo '=+= Successfully ran all tests =+='
fi

26
unit_tests.sh Normal file
View file

@ -0,0 +1,26 @@
#!/bin/bash
errors=()
echo '=== Testing anglais ==='
# read files
for file in $(find tests -type f); do
echo "-v- Test-running file $file -v-"
if ! ./cli/cli run "$file"; then
echo "-x- Error -x-"
errors+=("$file")
else
echo "-+- Success -+-"
fi
done
if [ 0 -ne "$(wc -w <<< "${errors[@]}")" ]; then
echo "=x= Errors occured while executing =x="
echo "erroring files: $(printf '%s ' "${errors[@]}")"
exit 1
else
echo '=+= Successfully ran all tests =+='
fi