fix: add more detail to test assertion (#16606)

In https://github.com/openai/codex/pull/16528, I am trying to get tests
running under Bazel on Windows, but currently I see:

```
thread 'suite::user_shell_cmd::user_shell_command_does_not_set_network_sandbox_env_var' (10220) panicked at core/tests\suite\user_shell_cmd.rs:358:5:
assertion failed: `(left == right)`

Diff < left / right > :
<1
>0
```

This PR updates the `assert_eq!()` to provide more information to help
diagnose the failure.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/16606).
* #16608
* __->__ #16606
This commit is contained in:
Michael Bolin
2026-04-02 12:34:42 -07:00
committed by GitHub
parent 2146e1b82d
commit f894c3f687

View File

@@ -350,13 +350,22 @@ async fn user_shell_command_does_not_set_network_sandbox_env_var() -> anyhow::Re
.submit(Op::RunUserShellCommand { command })
.await?;
let end_event = wait_for_event_match(&test.codex, |ev| match ev {
let ExecCommandEndEvent {
exit_code,
stdout,
stderr,
..
} = wait_for_event_match(&test.codex, |ev| match ev {
EventMsg::ExecCommandEnd(event) => Some(event.clone()),
_ => None,
})
.await;
assert_eq!(end_event.exit_code, 0);
assert_eq!(end_event.stdout.trim(), "not-set");
assert_eq!(
exit_code, 0,
"shell command should execute successfully. stdout=`{stdout}`, stderr=`{stderr}`",
);
assert_eq!(stdout.trim(), "not-set");
Ok(())
}