Skip to content

Commit

Permalink
feat: 补全kill的单测
Browse files Browse the repository at this point in the history
  • Loading branch information
Cnotech committed Jul 30, 2024
1 parent cdc09d5 commit adffdbe
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/types/steps/kill.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::ptr::replace;

use super::TStep;
use crate::types::interpretable::Interpretable;
use crate::types::permissions::PermissionKey;
Expand Down Expand Up @@ -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());
}

0 comments on commit adffdbe

Please sign in to comment.