Files
max-sixty__worktrunk/docs/demos/shared/fixtures/lib.rs
Maximilian Roos 96b8aa7757 Refactor demo infrastructure: consolidate shared code and rename demos (#270)
* Move backslash normalization to start of filter chain (#263)

By normalizing backslashes to forward slashes FIRST, all subsequent
path filters only need the forward-slash version. This removes:
- Duplicate path filters for backslash versions
- The later backslash normalization filter

Simplifies the filter chain by having one canonical path format.

Co-authored-by: Claude <noreply@anthropic.com>

* Combine ~/repo pattern with optional worktree suffix (#264)

Use a single pattern with optional capture group instead of two separate
patterns. The optional suffix (\.[a-zA-Z0-9_-]+)? matches worktree paths
like ~/repo.feature while also matching plain ~/repo.

Co-authored-by: Claude <noreply@anthropic.com>

* Inline symbol literals in formatted messages

Replace symbol constant references with their literal characters inside
cformat! color blocks. This ensures symbols render with proper coloring
instead of appearing outside the colored sections.

* Add demo-simple scaffold with shared fixtures and library

Extract common demo setup logic into reusable lib.py functions:
- prepare_base_repo() for git repo, Rust project, mock CLIs
- prepare_demo_repo() for full rich repo with varied branches
- commit_dated() for dated commits with offsets
- Helper functions for creating alpha/beta/hooks branches

Create shared fixtures directory:
- lib.rs and lib-hooks.rs for Rust project variants
- gh-mock.sh for mocked GitHub CLI with per-branch CI status
- alpha-readme.md for large diff demo content
- starship.toml for consistent shell prompt

Add demo-simple demo scaffold:
- Build script and VHS tape for simple workflow demo
- Shows hooks execution, branch creation, and removal
- Uses shared fixtures and library for setup

Update wt demo to use shared library, reducing duplication
by ~190 lines while maintaining identical repo structure.

* Refactor demo infrastructure: consolidate shared code and rename demos

- Create shared/ Python package with unified imports
  - Move lib.py and themes.py into shared/
  - Add __init__.py that re-exports all utilities
  - Move fixtures into shared/fixtures/

- Rename demos for clarity
  - demo-simple → wt-core (core workflow demo)
  - wt → wt-merge (merge-focused demo)

- Update doc references
  - Homepage and README use wt-core.gif
  - merge.md page uses wt-merge.gif

- Simplify gitignore
  - Use single glob pattern docs/demos/*/out/
  - Remove per-demo .gitignore files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add merge.md to lychee exclude_path

The merge.md page now has root-relative asset paths (/assets/wt-merge.gif)
that lychee can't resolve locally. These assets are fetched at deploy time.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add wt-merge demo GIF to merge command help

Add demo placeholder in cli.rs so the GIF appears in generated docs.
The placeholder expands to an HTML figure with light/dark variants.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update help snapshots for merge demo placeholder

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-20 21:04:40 -08:00

19 lines
250 B
Rust

pub fn add(a: i32, b: i32) -> i32 {
a + b
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_add() {
assert_eq!(add(2, 2), 4);
}
#[test]
fn test_add_negative() {
assert_eq!(add(-1, 1), 0);
}
}