fix(core) use regex for all shell_serialization tests (#5189)

## Summary
Thought I switched all of these to using a regex instead, but missed 2.
This should address our [flakey test
problem](https://github.com/openai/codex/actions/runs/18511206616/job/52752341520?pr=5185).

## Test Plan
- [x] Only updated unit tests
This commit is contained in:
Dylan
2025-10-14 16:29:02 -07:00
committed by GitHub
parent 0a0a10d8b3
commit 00debb6399

View File

@@ -740,23 +740,11 @@ async fn shell_output_is_structured_for_nonzero_exit() -> Result<()> {
.and_then(Value::as_str) .and_then(Value::as_str)
.expect("shell output string"); .expect("shell output string");
let expected_output = r"Exit code: 42 let expected_pattern = r"(?s)^Exit code: 42
Wall time: 0 seconds Wall time: [0-9]+(?:\.[0-9]+)? seconds
Output: Output:
"; ?$";
assert_eq!(output, expected_output); assert_regex_match(expected_pattern, output);
assert!(
serde_json::from_str::<Value>(output).is_err(),
"expected structured shell output to be plain text",
);
assert!(
output.starts_with("Exit code: 42\n"),
"expected non-zero exit code prefix, got {output:?}",
);
assert!(
output.contains("\nOutput:\n"),
"expected Output section, got {output:?}",
);
Ok(()) Ok(())
} }
@@ -807,18 +795,12 @@ async fn local_shell_call_output_is_structured() -> Result<()> {
.and_then(Value::as_str) .and_then(Value::as_str)
.expect("local shell output string"); .expect("local shell output string");
assert!( let expected_pattern = r"(?s)^Exit code: 0
serde_json::from_str::<Value>(output).is_err(), Wall time: [0-9]+(?:\.[0-9]+)? seconds
"expected structured local shell output to be plain text", Output:
); local shell
assert!( ?$";
output.starts_with("Exit code: 0\n"), assert_regex_match(expected_pattern, output);
"expected zero exit code prefix, got {output:?}",
);
assert!(
output.contains("local shell"),
"expected command stdout to be present, got {output:?}",
);
Ok(()) Ok(())
} }