From 8d5a2bb488c7bc3de9705460c5dfee5c9cbb2a5b Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 30 Dec 2020 22:18:32 -0600 Subject: [PATCH] cleaning up directory structure --- .github/workflows/onyx-build.yml | 2 +- .gitignore | 2 -- Makefile | 2 +- onyx => bin/onyx | Bin bin/test | 37 +++++++++++++++++++++++++++++++ docs/todo | 1 + runtests.sh | 36 ------------------------------ 7 files changed, 40 insertions(+), 40 deletions(-) rename onyx => bin/onyx (100%) create mode 100755 bin/test delete mode 100755 runtests.sh diff --git a/.github/workflows/onyx-build.yml b/.github/workflows/onyx-build.yml index 31f527b2..7d197358 100644 --- a/.github/workflows/onyx-build.yml +++ b/.github/workflows/onyx-build.yml @@ -18,4 +18,4 @@ jobs: - name: make run: make - name: run tests - run: ./runtests.sh + run: ./bin/test diff --git a/.gitignore b/.gitignore index 6dc7d768..6ce4354f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ **/*.o *.o tags -test.c -test *.wasm *.html session.vim diff --git a/Makefile b/Makefile index b923f94a..59c1bd30 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ endif INCLUDES=-I./include LIBS= -TARGET=./onyx +TARGET=./bin/onyx # These aren't working yet INSTALL_FOLDER=/usr/share/onyx diff --git a/onyx b/bin/onyx similarity index 100% rename from onyx rename to bin/onyx diff --git a/bin/test b/bin/test new file mode 100755 index 00000000..01d8dd6a --- /dev/null +++ b/bin/test @@ -0,0 +1,37 @@ +#!/bin/sh + +failed=0 +for test_file in ./tests/*.onyx ; do + filename=$(basename -- "$test_file") + name="${filename%.*}" + + echo "⏲ Checking $name.onyx" + + if ! ./bin/onyx "$test_file" -o "./tests/$name.wasm" >/dev/null; then + echo "❌ Failed to compile $name.onyx." + failed=1 + continue + fi + + if ! node onyxcmd.js "./tests/$name.wasm" > ./tmpoutput; then + echo "❌ Failed to run $name.onyx." + failed=1 + continue + fi + + if ! diff ./tmpoutput "./tests/$name" >/dev/null; then + echo "❌ Test output did not match." + diff ./tmpoutput "./tests/$name" + # failed=0 + continue + fi + + rm "./tests/$name.wasm" +done +rm ./tmpoutput + +([ $failed = 0 ] && echo "✔ All tests passed.") \ + || echo "❌ Some tests failed." + +exit $failed + diff --git a/docs/todo b/docs/todo index 3e90abe5..9099a620 100644 --- a/docs/todo +++ b/docs/todo @@ -158,6 +158,7 @@ Usability: [ ] Make README on GitHub better, and actually describe what to do [ ] Make compiler work on Windows [ ] Make compiler work on MacOS + [ ] Make Onyx easier to use from JS [ ] Add examples for the following language features: - Slices - Dynamic Arrays diff --git a/runtests.sh b/runtests.sh deleted file mode 100755 index 92ea4fa4..00000000 --- a/runtests.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -failed=0 -for test_file in ./tests/*.onyx ; do - filename=$(basename -- "$test_file") - name="${filename%.*}" - - echo "⏲ Checking $name.onyx" - - if ! ./onyx "$test_file" -o "./tests/$name.wasm" >/dev/null; then - echo "❌ Failed to compile $name.onyx." - failed=1 - continue - fi - - if ! node onyxcmd.js "./tests/$name.wasm" > ./tmpoutput; then - echo "❌ Failed to run $name.onyx." - failed=1 - continue - fi - - if ! diff ./tmpoutput "./tests/$name" >/dev/null; then - echo "❌ Test output did not match." - diff ./tmpoutput "./tests/$name" - # failed=0 - continue - fi - - rm "./tests/$name.wasm" -done -rm ./tmpoutput - -([ $failed = 0 ] && echo "✔ All tests passed.") \ - || echo "❌ Some tests failed." - -exit $failed \ No newline at end of file -- 2.25.1