mirror of https://codeberg.org/glenneth/stash.git
- Add proper symlink preservation when stashing - Handle existing symlinks correctly - Maintain symlink chains when moving to dotfiles - Fix path handling for .config directory |
||
|---|---|---|
| .. | ||
| README.md | ||
| conflict-test.scm | ||
| file-ops-test.scm | ||
| package-test.scm | ||
| paths-test.scm | ||
| run-tests.scm | ||
| test-helpers.scm | ||
| tree-test.scm | ||
README.md
Stash Test Suite
This directory contains the comprehensive test suite for the Stash project. The tests are written using SRFI-64, Scheme's standard testing framework.
Test Structure
run-tests.scm- Main test runner that executes all test filestest-helpers.scm- Common testing utilities and fixtures- Module-specific test files:
paths-test.scm- Tests for path handling functionalitypackage-test.scm- Tests for package managementtree-test.scm- Tests for directory tree operationsfile-ops-test.scm- Tests for file system operationsconflict-test.scm- Tests for conflict detection and resolution
Running Tests
You can run the entire test suite using the script in the project root:
./run-tests.sh
Or run individual test files directly with Guile:
GUILE_LOAD_PATH="$PWD:$GUILE_LOAD_PATH" guile tests/paths-test.scm
Writing New Tests
- Create a new test file following the naming convention
*-test.scm - Use the SRFI-64 test framework
- Import required modules and test helpers:
(use-modules (srfi srfi-64) (stash your-module) (test-helpers)) - Organize tests into logical groups using
test-group - Use the test helper functions for common operations
Example:
(test-begin "your-module")
(test-group "feature-name"
(test-assert "description"
(your-function-call)))
(test-end "your-module")
Test Helpers
The test-helpers.scm module provides several utilities:
with-temporary-directory: Creates and manages temporary test directoriescreate-test-file: Creates test files with optional contentcreate-test-symlink: Creates test symlinksdelete-directory-recursive: Safely removes test directories
Adding New Test Helpers
If you find yourself repeating test setup code, consider adding new helper functions to test-helpers.scm.