tests: show CLI output when the shell corpus exits incorrectly

This commit is contained in:
2026-11-08 00:55:29 +00:00
parent 6ba35b0683
commit 994ff9da55
+15 -3
View File
@@ -21,7 +21,10 @@ fn world_copies_programs_and_nested_source_only_once() -> anyhow::Result<()> {
b"ref: refs/heads/main\n",
)?;
std::fs::write(bundle.join("src/sausage/README.md"), b"source")?;
for (name, target) in [("readme-link", "README.md"), ("broken-link", "missing.wasm")] {
for (name, target) in [
("readme-link", "README.md"),
("broken-link", "missing.wasm"),
] {
std::os::unix::fs::symlink(target, bundle.join("src/sausage").join(name))?;
}
let path = temp.path().join("world");
@@ -35,7 +38,10 @@ fn world_copies_programs_and_nested_source_only_once() -> anyhow::Result<()> {
b"source"
);
assert!(path.join("world/src/sausage/.git/HEAD").is_file());
for (name, target) in [("readme-link", "README.md"), ("broken-link", "missing.wasm")] {
for (name, target) in [
("readme-link", "README.md"),
("broken-link", "missing.wasm"),
] {
assert_eq!(
std::fs::read_link(path.join("world/src/sausage").join(name))?,
Path::new(target)
@@ -563,7 +569,13 @@ async fn corpus_matches_bash() {
.args(["-c", &script])
.output()
.unwrap();
assert_eq!(cli.status.code(), result.status.code());
assert_eq!(
cli.status.code(),
result.status.code(),
"CLI stdout: {}\nCLI stderr: {}",
String::from_utf8_lossy(&cli.stdout),
String::from_utf8_lossy(&cli.stderr)
);
assert_eq!(
cli.stdout,
expected.as_bytes(),