This document describes all available tests for git-cross, including their purpose and how to execute them.
| ID | Test Name | Description | Command |
|---|---|---|---|
| TC-001 | crossfile-001 | Basic patch workflow | just test 001 or ./test/bash/examples/crossfile-001.sh |
| TC-002 | crossfile-002 | Dual remote workflow | just test 002 or ./test/bash/examples/crossfile-002.sh |
| TC-003 | crossfile-003 | Asciinema example | just test 003 or ./test/bash/examples/crossfile-003.sh |
| TC-005 | crossfile-005 | Exec command & post-hooks | just test 005 or ./test/bash/examples/crossfile-005.sh |
| TC-006 | core-improvements | Core improvements suite | ./test/bash/core-improvements.sh |
Quick Start:
# Run all tests
just test
# Run specific test by ID
just test 001
# Run directly
./test/bash/examples/crossfile-001.shBefore running tests, ensure you have:
- fish shell ≥ 3.0
- just command runner
- git ≥ 2.20
- Homebrew (for PATH setup on macOS/Linux)
- rsync
Execute the complete test suite:
./test/run-all.shThis runs all example Crossfile tests and generates a report in test/results/verification.json.
These tests validate the core workflow using numbered Crossfile examples.
Test ID: crossfile-001
Description: Tests basic use and patch commands with a single remote repository. Validates that files are correctly vendored from upstream.
Command:
./test/bash/examples/crossfile-001.shWhat it tests:
- Remote registration (
cross use) - Basic patching (
cross patch) - Sparse checkout configuration
- File synchronization via rsync
Test ID: crossfile-002
Description: Tests vendoring from multiple remote repositories (khue and bill) into different local paths.
Command:
./test/bash/examples/crossfile-002.shWhat it tests:
- Multiple remote management
- Concurrent patches from different upstreams
- Worktree isolation
- Path organization (deploy/metal, deploy/flux)
Test ID: crossfile-003
Description: Tests patching a directory with the same name as the remote path (asciinema → asciinema).
Command:
./test/bash/examples/crossfile-003.shWhat it tests:
- Same-name directory patching
CROSS_FETCH_DEPENDENCIESenvironment handling- Path mapping edge cases
Test ID: crossfile-005
Description: Tests the cross exec command for running post-hooks and custom Justfile recipes.
Command:
./test/bash/examples/crossfile-005.shWhat it tests:
cross execcommand execution- Integration with user Justfile recipes
- Post-hook automation
- Command chaining in Crossfile
Test ID: core-improvements
Description: Validates all core improvements implemented in Phase 7: patch arguments, branch detection, mkdir support, Crossfile idempotency, and sync safety.
Command:
./test/bash/core-improvements.shWhat it tests:
remote:path:branchsyntax support- Automatic branch detection (main/master)
mkdir -pfor intermediate directories- Crossfile idempotency (no duplicates on re-run)
- Sync safety checks (uncommitted changes warning)
Test runs generate logs in test/results/:
test/results/
├── examples/
│ ├── crossfile-001-bash.log
│ ├── crossfile-002-bash.log
│ ├── crossfile-003-bash.log
│ └── crossfile-005-bash.log
├── verification.json # Machine-readable test report
└── verification.log # Human-readable test log
- PASS: Test completed successfully
- FAIL: Test failed (check log file for details)
- SKIPPED: Test script missing or not executable
View the JSON report:
cat test/results/verification.json | jqEach test runs in a temporary workspace (/tmp/cross-e2e-*) and uses sandboxed git configuration:
- No GPG signing (uses
GIT_CONFIG_GLOBALoverride) - Isolated from user settings (custom .gitconfig)
- Clean environment (no interference with
~/.gitconfig)
To debug a specific test:
# Enable verbose mode
set -x
./test/bash/examples/crossfile-001.shThe test suite supports scenario-based execution:
./test/run-all.sh --scenario examplesRuns all numbered Crossfile tests (001, 002, 003, 005).
./test/run-all.sh --scenario useTests alias registration and idempotency checks (not yet implemented).
./test/run-all.sh --scenario patchTests patch workflow regression suite (not yet implemented).
./test/run-all.sh --scenario allRuns every scenario sequentially.
To add a new test:
- Create test script:
test/bash/examples/crossfile-XXX.sh - Follow the pattern:
#!/usr/bin/env bash set -euo pipefail workspace=${1:?"workspace path required"} ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # Your test logic here
- Create example Crossfile:
examples/Crossfile-XXX - Update this documentation: Add TC-XXX section above
- Test it:
./test/bash/examples/crossfile-XXX.sh
- Ensure you're using Bash ≥ 3.2
- Check that all required variables are initialized
- Run with
set -xfor debugging
- Install fish shell:
brew install fish - Verify:
fish --version
- Install just:
brew install justorcargo install just - Verify:
just --version
- The fixture tool (
scripts/fixture-tooling/seed-fixtures.sh) is not yet implemented - Tests use real git repositories instead (slower but functional)
Tests are designed to run in CI environments:
# Example GitHub Actions
- name: Run tests
run: ./test/run-all.sh
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results
path: test/results/- README.md - Quick start testing guide
- specs/001-cross-test-strategy/ - Detailed test strategy
- AGENTS.md - Testing section for AI agents