From bfcd4cf19c0bcd6ce6cba0f492f22a524b85d668 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Mon, 14 Dec 2020 11:04:51 -0600 Subject: [PATCH] added a warning if using an invalid key type --- core/map.onyx | 2 +- runtests.sh | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/map.onyx b/core/map.onyx index d1f2e533..de7264b5 100644 --- a/core/map.onyx +++ b/core/map.onyx @@ -114,7 +114,7 @@ MapLookupResult :: struct { lookup :: proc (use map: ^Map($K, $V), key: K) -> MapLookupResult { lr := MapLookupResult.{}; - hash := hash_function(key); + hash := hash_function(key); // You cannot use this type for the key, unless you add an overload. lr.hash_index = hash % hashes.count; lr.entry_index = hashes[lr.hash_index]; diff --git a/runtests.sh b/runtests.sh index 4c01bce5..92ea4fa4 100755 --- a/runtests.sh +++ b/runtests.sh @@ -1,6 +1,6 @@ #!/bin/sh -success=1 +failed=0 for test_file in ./tests/*.onyx ; do filename=$(basename -- "$test_file") name="${filename%.*}" @@ -9,20 +9,20 @@ for test_file in ./tests/*.onyx ; do if ! ./onyx "$test_file" -o "./tests/$name.wasm" >/dev/null; then echo "❌ Failed to compile $name.onyx." - success=0 + failed=1 continue fi if ! node onyxcmd.js "./tests/$name.wasm" > ./tmpoutput; then echo "❌ Failed to run $name.onyx." - success=0 + failed=1 continue fi if ! diff ./tmpoutput "./tests/$name" >/dev/null; then echo "❌ Test output did not match." diff ./tmpoutput "./tests/$name" - success=0 + # failed=0 continue fi @@ -30,5 +30,7 @@ for test_file in ./tests/*.onyx ; do done rm ./tmpoutput -([ $success = 1 ] && echo "✔ All tests passed.") \ +([ $failed = 0 ] && echo "✔ All tests passed.") \ || echo "❌ Some tests failed." + +exit $failed \ No newline at end of file -- 2.25.1