Test suite overview
The Walrus test suite is located in thetests/ directory and contains .walrus files that exercise various language features.
As of now, the testing suite is extremely incomplete and immature. Many language features lack dedicated tests, and existing tests may not cover all edge cases. There is no automatic test runner or framework in place yet - correctness is evaluated manually by inspecting output.
Running tests
Individual test files
You can run individual test files using the Walrus interpreter:Test file categories
The test files cover various language features:- Control flow - if/else, while loops, for loops, break/continue
- Functions - Named functions, anonymous functions, closures, recursion
- Data structures - Lists, dictionaries, tuples, ranges
- Structs - Struct definitions, static methods
- String manipulation - Slicing, indexing, format strings
- Operators - Arithmetic, comparison, logical, short-circuit evaluation
- Memory management - Garbage collection stress tests
- Standard library - File I/O, system operations, math functions
Manual validation
Currently, tests are validated by:- Running the test file
- Inspecting the output
- Verifying expected behavior manually
Comment support in tests
Walrus supports both single-line and multi-line comments in test files: Single-line comments:Writing new tests
When adding new language features, create corresponding test files:- Create a
.walrusfile in thetests/directory - Name it descriptively (e.g.,
string_slicing.walrus) - Include comments explaining what is being tested
- Add test cases that cover edge cases
- Run the test to verify correct behavior
Future improvements
Contributions to improve the test suite are highly encouraged:- Automatic test runner framework
- Expected output validation
- Test coverage reporting
- Performance regression testing
- Integration tests
- Error handling tests