Skip to content

Commit

Permalink
chore: 添加绝对路径校验案例
Browse files Browse the repository at this point in the history
  • Loading branch information
Cnotech committed Nov 11, 2023
1 parent 4bfbbdb commit 0811df9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/CallInstaller/workflows/setup.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
name = "Call Installer"
step = "Execute"
command = "Installer.exe /S"
call_installer = true

[install_2]
name = "Call Installer 2"
step = "Execute"
command = "${AppData}/Installer.exe /S"
call_installer = true
23 changes: 23 additions & 0 deletions src/types/steps/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,29 @@ impl Generalizable for StepExecute {
}
}

#[test]
fn test_execute_validate() {
let located = String::new();

let res = StepExecute {
command: "${AppData}/Installer.exe /S".to_string(),
pwd: None,
call_installer: Some(true),
wait: None,
}
.verify_self(&located);
assert!(res.is_ok());

let res = StepExecute {
command: "C:/Windows/Installer.exe /S".to_string(),
pwd: None,
call_installer: Some(true),
wait: None,
}
.verify_self(&located);
assert!(res.is_err());
}

#[test]
fn test_execute_manifest() {
let mut fs = MixedFS::new("examples/Dism++/Dism++".to_string());
Expand Down

0 comments on commit 0811df9

Please sign in to comment.