#[cfg(feature = "sandbox")]
#[test]
fn a_build_with_the_engine_feature_carries_one() {
let mut engine = crate::doctor::host::execution_engine()
.expect("a build with the feature starts its engine");
let job = runtime::SandboxJob {
wasm: std::path::PathBuf::from("no-such-module.wasm"),
argv: Vec::new(),
env: Vec::new(),
stdin: Vec::new(),
mounts: Vec::new(),
fuel: runtime::Fuel(1_000),
};
let said = format!("{:?}", engine.run(&job));
assert!(
!said.contains("this build carries no execution engine"),
"the feature is on and the run still met the absent engine: {said}"
);
}
#[test]
fn pwsh_is_handed_to_a_run_only_at_major_seven_or_later() {
use crate::doctor::host::seven_or_later;
use crate::doctor::{Presence, Version};
let at = std::path::PathBuf::from("pwsh");
let said = |text: &str| Presence::Present {
at: at.clone(),
version: Version::Said(text.to_owned()),
};
assert_eq!(seven_or_later(&said("PowerShell 7.4.6")), Some(at.clone()));
assert_eq!(seven_or_later(&said("PowerShell 10.0.0")), Some(at.clone()));
assert_eq!(seven_or_later(&said("PowerShell 6.2.7")), None);
assert_eq!(
seven_or_later(&Presence::Present {
at: at.clone(),
version: Version::Silent,
}),
None
);
}