#!/bin/bash # Exit on error set -e # Directory setup PROJECT_ROOT="$PWD" MODULE_DIR="$PROJECT_ROOT/modules" TEST_DIR="$PROJECT_ROOT/tests" # Add project directories to GUILE_LOAD_PATH export GUILE_LOAD_PATH="$PROJECT_ROOT:$MODULE_DIR:$TEST_DIR:$GUILE_LOAD_PATH" export GUILE_LOAD_COMPILED_PATH="$MODULE_DIR:$TEST_DIR:$GUILE_LOAD_COMPILED_PATH" # Disable auto-compilation during tests export GUILE_AUTO_COMPILE=0 # Compile all Scheme files first echo "Compiling Scheme modules..." find "$MODULE_DIR" -name "*.scm" -type f -exec guild compile {} \; echo "Compiling test files..." find "$TEST_DIR" -name "*.scm" -type f -exec guild compile {} \; # Function to run a test file run_test() { local test_file="$1" echo "Running tests in $test_file..." guile --no-auto-compile "$test_file" } # Run all test files echo "Running tests..." for test_file in "$TEST_DIR"/*-test.scm; do if [ -f "$test_file" ]; then run_test "$test_file" fi done echo "All tests completed successfully!"