2.1 KiB
Running Rhai Tests
This document describes how to run the Rhai tests for the SAL library.
Test Structure
The Rhai tests are organized by module in the src/rhai_tests
directory:
src/rhai_tests/os/
: Tests for the OS modulesrc/rhai_tests/git/
: Tests for the Git module
Each module directory contains:
- Individual test scripts (e.g.,
01_file_operations.rhai
) - A test runner script (
run_all_tests.rhai
) that runs all tests for that module
Running Tests
Running All Tests
To run all Rhai tests across all modules, use the provided shell script:
./run_rhai_tests.sh
This script:
- Finds all test runner scripts in the
src/rhai_tests
directory - Runs each test runner
- Reports the results for each module
- Provides a summary of all test results
The script will exit with code 0 if all tests pass, or code 1 if any tests fail.
Running Tests for a Specific Module
To run tests for a specific module, use the herodo
command with the module's test runner:
herodo --path src/rhai_tests/os/run_all_tests.rhai
Running Individual Tests
To run a specific test, use the herodo
command with the test script:
herodo --path src/rhai_tests/os/01_file_operations.rhai
Test Output
The test output includes:
- Information about what's being tested
- Success or failure messages for each test
- A summary of test results
Successful tests are indicated with a checkmark (✓), while failed tests show an error message.
Adding New Tests
When adding new tests:
- Create a new test script in the appropriate module directory
- Update the module's test runner script to include the new test
- Update the module's documentation to describe the new test
The run_rhai_tests.sh
script will automatically find and run the new tests as long as they're included in a module's test runner script.
Troubleshooting
If tests fail, check the following:
- Make sure the
herodo
binary is in your PATH - Verify that the test scripts have the correct permissions
- Check for any dependencies required by the tests (e.g.,
git
for Git module tests) - Look for specific error messages in the test output