Merge nucleic/sleek-thistle-egret-fyej into dev
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
name: "CLI tests"
|
||||
cases:
|
||||
- name: "Basic echo"
|
||||
stdin: "echo hello world"
|
||||
expected_exit_code: 0
|
||||
expected_stdout: "hello world\n"
|
||||
|
||||
- name: "Exit code propagates"
|
||||
stdin: "exit 42"
|
||||
expected_exit_code: 42
|
||||
# WASI 0.2's wasi-cli/exit interface only models success/failure, so any
|
||||
# non-zero exit code is clamped to 1 by the host (e.g., wasmtime).
|
||||
incompatible_platforms: ["wasi"]
|
||||
|
||||
- name: "Echo via args"
|
||||
args:
|
||||
- "-c"
|
||||
- "echo from args"
|
||||
expected_exit_code: 0
|
||||
expected_stdout: "from args\n"
|
||||
|
||||
- name: "Version flag succeeds"
|
||||
args:
|
||||
- "--version"
|
||||
expected_exit_code: 0
|
||||
# Note: can't easily check stdout content as it varies
|
||||
|
||||
- name: "Help flag succeeds"
|
||||
args:
|
||||
- "--help"
|
||||
expected_exit_code: 0
|
||||
|
||||
- name: "Invalid option fails"
|
||||
args:
|
||||
- "--unknown-argument-here"
|
||||
expected_exit_code: 2
|
||||
# Exit code 2 for argument parsing errors.
|
||||
# WASI 0.2's wasi-cli/exit interface only models success/failure, so any
|
||||
# non-zero exit code is clamped to 1 by the host (e.g., wasmtime).
|
||||
incompatible_platforms: ["wasi"]
|
||||
|
||||
- name: "Explicit config file not found fails"
|
||||
removed_default_args:
|
||||
- "--no-config"
|
||||
args:
|
||||
- "--config"
|
||||
- "/nonexistent/path/to/config.toml"
|
||||
- "-c"
|
||||
- "echo should_not_run"
|
||||
expected_exit_code: 1
|
||||
|
||||
- name: "Explicit config file valid"
|
||||
removed_default_args:
|
||||
- "--no-config"
|
||||
test_files:
|
||||
- path: "config.toml"
|
||||
contents: |
|
||||
[ui]
|
||||
syntax-highlighting = false
|
||||
|
||||
[experimental]
|
||||
zsh-hooks = false
|
||||
args:
|
||||
- "--config"
|
||||
- "config.toml"
|
||||
- "-c"
|
||||
- "echo config_loaded"
|
||||
expected_exit_code: 0
|
||||
expected_stdout: "config_loaded\n"
|
||||
|
||||
- name: "Config file with unknown fields succeeds"
|
||||
removed_default_args:
|
||||
- "--no-config"
|
||||
test_files:
|
||||
- path: "config.toml"
|
||||
contents: |
|
||||
[ui]
|
||||
syntax-highlighting = true
|
||||
future-setting = "ignored"
|
||||
|
||||
[unknown-section]
|
||||
foo = "bar"
|
||||
args:
|
||||
- "--config"
|
||||
- "config.toml"
|
||||
- "-c"
|
||||
- "echo forward_compat"
|
||||
expected_exit_code: 0
|
||||
expected_stdout: "forward_compat\n"
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
source: brush-test-harness/src/runner.rs
|
||||
expression: snapshot_content
|
||||
---
|
||||
exit_code: 0
|
||||
stdout: |
|
||||
hello
|
||||
stderr: ""
|
||||
files:
|
||||
trace.txt: |
|
||||
+ echo hello
|
||||
+ true
|
||||
@@ -0,0 +1,14 @@
|
||||
name: "Tracing tests"
|
||||
cases:
|
||||
- name: "xtrace-file captures trace output"
|
||||
args: ["--xtrace-file", "trace.txt"]
|
||||
stdin: |
|
||||
echo hello
|
||||
true
|
||||
expected_exit_code: 0
|
||||
snapshot: true
|
||||
# std::fs::File::try_clone() returns "operation not supported" on
|
||||
# wasm32-wasip2, so brush's OpenFile::clone() falls back to a failing
|
||||
# writer and the trace file ends up empty. Affects all output redirection
|
||||
# under wasi, not just xtrace.
|
||||
incompatible_platforms: ["wasi"]
|
||||
Reference in New Issue
Block a user