-
Notifications
You must be signed in to change notification settings - Fork 0
Testing #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Testing #8
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6c164f0
CI for linting, build, tests, and test coverage
cdprice02 d87ffad
Refactor ShellIo to manage input and output differently
cdprice02 21baaf6
Test execution and parsing
cdprice02 c62177f
Add tarpaulin
cdprice02 fd9e381
Temp add testing branch for CI
cdprice02 154fe7a
Remove tarpaulin as a dev dep
cdprice02 aa04f5f
Update coverage job config
cdprice02 b9615f2
Add first integration tests
cdprice02 e2822d1
Add comprehensive test infrastructure and fix clippy warnings
90566a1
test: improve coverage to pass 80% threshold
a462bf3
fix: accept Windows paths in test_type_system_executable
db563d0
refactor: dissolve integration_additional.rs into proper test files
ae7e3cd
refactor: rewrite test harness to use library API via MockIo
84b6b0d
fix: remove temp triggers for ci
59c063b
fix: address Copilot review comments for cross-platform CI
c4d49b6
refactor: move home_dir and cwd into Shell state, eliminating process…
a1333e7
fix: normalize expected values in fs tests to fix Windows CI
2b83f6f
fix: address second-round Copilot review comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: lint build test | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| dev: | ||
| name: dev (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| - name: build dev | ||
| run: cargo build --verbose | ||
| - name: test dev | ||
| run: cargo test --verbose | ||
|
|
||
| release: | ||
| name: release (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| - name: build release | ||
| run: cargo build --release --verbose | ||
| - name: test release | ||
| run: cargo test --release --verbose | ||
| - name: upload release artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: release-build-${{ matrix.os }} | ||
| path: target/release/ | ||
|
|
||
| lint: | ||
| name: clippy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| - name: run clippy | ||
| run: cargo clippy --all-targets --all-features -- -D warnings | ||
|
|
||
| coverage: | ||
| name: coverage | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| - name: install tarpaulin | ||
| run: cargo install cargo-tarpaulin | ||
| - name: run coverage | ||
| env: | ||
| COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} | ||
| run: | | ||
| if [ -n "$COVERALLS_REPO_TOKEN" ]; then | ||
| cargo tarpaulin --verbose --all-features --workspace --timeout 180 --coveralls "$COVERALLS_REPO_TOKEN" --fail-under 80 | ||
| else | ||
| cargo tarpaulin --verbose --all-features --workspace --timeout 180 --fail-under 80 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,3 +12,6 @@ target/ | |
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS | ||
| tmp/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project | ||
|
|
||
| **ferrish** is an early-stage shell implementation in Rust. Correctness over performance; when a trade-off exists between the two, correctness wins. | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| # Build | ||
| cargo build | ||
| cargo build --release | ||
|
|
||
| # Test (all) | ||
| cargo test | ||
|
|
||
| # Test (single integration test by name) | ||
| cargo test --test builtin test_name | ||
|
|
||
| # Test (single unit test) | ||
| cargo test -p ferrish test_name | ||
|
|
||
| # Lint (CI enforces no warnings) | ||
| cargo clippy --all-targets --all-features -- -D warnings | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| Input flows through: **Shell** → **Parser** → **Executor** → **BuiltIn | Executable** | ||
|
|
||
| - `src/shell.rs` — REPL loop; reads input, calls parser, calls executor, handles fatal vs. recoverable errors | ||
| - `src/parser.rs` — Splits input into command + args; resolves whether the command is a built-in, a PATH executable, or unrecognized | ||
| - `src/executor.rs` — Dispatches to built-in handlers or spawns external processes | ||
| - `src/command/builtin.rs` — Implementations of `exit`, `cd`, `echo`, `pwd`, `type` | ||
| - `src/command/executable.rs` — Wraps an external binary found on PATH | ||
| - `src/error.rs` — `ShellError` enum; distinguishes fatal errors (process spawn/wait failures) from recoverable ones (command not found, bad path) | ||
| - `src/io.rs` — `ShellIo` trait with `StandardIo` (real I/O) and `MockIo` (testing); this abstraction is what makes unit tests possible without spawning a process | ||
|
|
||
| ## Testing Strategy | ||
|
|
||
| Two layers: | ||
|
|
||
| 1. **Unit tests** — embedded in each module via `#[cfg(test)]`, use `MockIo` for I/O | ||
| 2. **Integration tests** (`tests/`) — exercise the `ferrish::Shell` library via the `ShellTest` harness in `tests/harness.rs`, using `MockIo` for I/O | ||
|
|
||
| The `ShellTest` builder in `harness.rs` is the primary integration test interface. It runs the shell in-process, creates an isolated `HOME` via `tempfile`, and captures stdout/stderr. Prefer integration tests for anything user-visible. | ||
|
|
||
| ## Key Conventions | ||
|
|
||
| - **File-based modules** — no `mod.rs`; each module is a standalone `.rs` file | ||
| - **Error reporting** — miette for user-facing errors with span context; `thiserror` for internal error types | ||
| - **REPL responsiveness** — lex/parse must complete in <100ms for typical input | ||
| - **State** — keep shell state (env vars, working dir) centralized and test scoping/isolation explicitly |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.