mirror of
https://github.com/openai/codex.git
synced 2026-04-28 02:11:08 +03:00
fix(exec-policy) No empty command lists (#11397)
## Summary This should rarely, if ever, happen in practice. But regardless, we should never provide an empty list of `commands` to ExecPolicy. This PR is almost entirely adding test around these cases. ## Testing - [x] Adds a bunch of unit tests for this
This commit is contained in:
@@ -431,6 +431,21 @@ mod tests {
|
||||
assert!(parse_seq("ls &&").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_empty_command_position_with_leading_operator() {
|
||||
assert!(parse_seq("&& ls").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_empty_command_position_with_double_separator() {
|
||||
assert!(parse_seq("ls ;; pwd").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_empty_command_position_with_empty_pipeline_segment() {
|
||||
assert!(parse_seq("ls | | wc").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_zsh_lc_plain_commands() {
|
||||
let command = vec!["zsh".to_string(), "-lc".to_string(), "ls".to_string()];
|
||||
|
||||
Reference in New Issue
Block a user