diff --git a/src/types/steps/kill.rs b/src/types/steps/kill.rs index 88b3bcb6..76b7d375 100644 --- a/src/types/steps/kill.rs +++ b/src/types/steps/kill.rs @@ -1,3 +1,5 @@ +use std::ptr::replace; + use super::TStep; use crate::types::interpretable::Interpretable; use crate::types::permissions::PermissionKey; @@ -120,3 +122,38 @@ fn test_kill() { .run(&mut cx) .unwrap(); } + +#[test] +fn test_kill_corelation() { + let mut cx = WorkflowContext::_demo(); + let mut mixed_fs = MixedFS::new("".to_string()); + + // 反向工作流 + StepKill { + target: "windows".to_string(), + } + .reverse_run(&mut cx) + .unwrap(); + + // 装箱单 + assert!(StepKill { + target: "code.exe".to_string(), + } + .get_manifest(&mut mixed_fs) + .is_empty()); + + // 解释 + assert_eq!(StepKill { + target: "${Home}".to_string(), + }.interpret(|s|s.replace("${Home}", "C:/Users/Nep")),StepKill { + target: "${Home}".to_string(), + }); + + // 校验 + assert!(StepKill { + target: "code.exe".to_string(), + }.verify_self(&"".to_string()).is_ok()); + assert!(StepKill { + target: "code".to_string(), + }.verify_self(&"".to_string()).is_ok()); +}