2025-04-24 17:14:47 -07:00
|
|
|
use codex_execpolicy::Error;
|
2025-05-07 08:37:48 -07:00
|
|
|
use codex_execpolicy::parse_sed_command;
|
2025-04-24 17:14:47 -07:00
|
|
|
|
|
|
|
|
#[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(),
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|