Skip to content

Commit

Permalink
test: resolve false errors about side effects in bash-completion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno committed Feb 3, 2025
1 parent 1e275c0 commit f56015f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,18 @@ There's a long list of OSS crates whose shoulders this project rests on. Notably
* [`tokio`](https://github.com/tokio-rs/tokio) - async, well, everything
* [`nix` rust crate](https://github.com/nix-rust/nix) - higher-level APIs for Unix/POSIX system APIs

Huge kudos and thanks also to `pprof` and `criterion` projects for enabling awesome flamegraphs in smooth integration with `cargo bench`'s standard benchmarking facilities.
For testing, performance benchmarking, and other important engineering support, we use and love:

* [`pprof-rs`](https://github.com/tikv/pprof-rs) - for sampling-based CPU profiling
* [`criterion.rs`](https://github.com/bheisler/criterion.rs) - for statistics-based benchmarking
* [`bash-completion`](https://github.com/scop/bash-completion) - for its completion test suite and general completion support!

## Links: other shell implementations

There are a number of other POSIX-ish shells implemented in a non-C/C++ implementation language. Some inspirational examples include:

* [Nushell](https://www.nushell.sh/) - modern Rust-implemented shell (which also provides the `reedline` crate we use!)
* [Rusty Bash](https://github.com/shellgei/rusty_bash)
* [mvdan/sh](https://github.com/mvdan/sh)
* [`nushell`](https://www.nushell.sh/) - modern Rust-implemented shell (which also provides the `reedline` crate we use!)
* [`rusty_bash`](https://github.com/shellgei/rusty_bash)
* [`mvdan/sh`](https://github.com/mvdan/sh)

We're sure there are plenty more; we're happy to include links to them as well.
8 changes: 8 additions & 0 deletions brush-core/src/builtins/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,14 @@ fn display_all(context: &commands::ExecutionContext<'_>) -> Result<(), error::Er
continue;
}

// TODO: For now, skip all dynamic variables. The current behavior
// of bash is not quite clear. We've empirically found that some
// special variables don't get displayed until they're observed
// at least once.
if matches!(var.value(), variables::ShellValue::Dynamic { .. }) {
continue;
}

writeln!(
context.stdout(),
"{name}={}",
Expand Down

0 comments on commit f56015f

Please sign in to comment.