use super::{Sandbox, SandboxError, SandboxPolicy};
#[derive(Debug, Clone, Copy)]
pub struct NoopSandbox;
impl Sandbox for NoopSandbox {
fn name(&self) -> &'static str {
"noop"
}
fn supports(&self, _policy: &SandboxPolicy) -> Result<(), SandboxError> {
Ok(())
}
fn wrap(
&self,
_cmd: &mut tokio::process::Command,
_policy: &SandboxPolicy,
) -> Result<(), SandboxError> {
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn noop_supports_any_policy() {
let sb = NoopSandbox;
let policy = SandboxPolicy::default();
assert!(sb.supports(&policy).is_ok());
}
#[test]
fn noop_wrap_is_identity() {
let sb = NoopSandbox;
let policy = SandboxPolicy::default();
let mut cmd = tokio::process::Command::new("bash");
assert!(sb.wrap(&mut cmd, &policy).is_ok());
}
}