Files
llmx/codex-rs/execpolicy/tests/parse_sed_command.rs
jcoens-openai 8a89d3aeda Update cargo to 2024 edition (#842)
Some effects of this change:
- New formatting changes across many files. No functionality changes
should occur from that.
- Calls to `set_env` are considered unsafe, since this only happens in
tests we wrap them in `unsafe` blocks
2025-05-07 08:37:48 -07:00

24 lines
545 B
Rust

use codex_execpolicy::Error;
use codex_execpolicy::parse_sed_command;
#[test]
fn parses_simple_print_command() {
assert_eq!(parse_sed_command("122,202p"), Ok(()));
}
#[test]
fn rejects_malformed_print_command() {
assert_eq!(
parse_sed_command("122,202"),
Err(Error::SedCommandNotProvablySafe {
command: "122,202".to_string(),
})
);
assert_eq!(
parse_sed_command("122202"),
Err(Error::SedCommandNotProvablySafe {
command: "122202".to_string(),
})
);
}