stash/tests
GLENN THOMPSON 14b20d6028 feat: improve symlink handling in file-ops
- Add proper symlink preservation when stashing
- Handle existing symlinks correctly
- Maintain symlink chains when moving to dotfiles
- Fix path handling for .config directory
2024-12-06 19:31:47 +03:00
..
README.md feat: Comprehensive test suite and documentation update 2024-12-06 16:08:27 +03:00
conflict-test.scm feat: Comprehensive test suite and documentation update 2024-12-06 16:08:27 +03:00
file-ops-test.scm feat: Comprehensive test suite and documentation update 2024-12-06 16:08:27 +03:00
package-test.scm feat: Comprehensive test suite and documentation update 2024-12-06 16:08:27 +03:00
paths-test.scm feat: Comprehensive test suite and documentation update 2024-12-06 16:08:27 +03:00
run-tests.scm feat: Comprehensive test suite and documentation update 2024-12-06 16:08:27 +03:00
test-helpers.scm feat: Comprehensive test suite and documentation update 2024-12-06 16:08:27 +03:00
tree-test.scm feat: improve symlink handling in file-ops 2024-12-06 19:31:47 +03:00

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 files
  • test-helpers.scm - Common testing utilities and fixtures
  • Module-specific test files:
    • paths-test.scm - Tests for path handling functionality
    • package-test.scm - Tests for package management
    • tree-test.scm - Tests for directory tree operations
    • file-ops-test.scm - Tests for file system operations
    • conflict-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

  1. Create a new test file following the naming convention *-test.scm
  2. Use the SRFI-64 test framework
  3. Import required modules and test helpers:
    (use-modules (srfi srfi-64)
                 (stash your-module)
                 (test-helpers))
    
  4. Organize tests into logical groups using test-group
  5. 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 directories
  • create-test-file: Creates test files with optional content
  • create-test-symlink: Creates test symlinks
  • delete-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.