Skip to content

Commit dd10f57

Browse files
author
Dilawar Singh
committed
Adds more tests
1 parent 7ee9787 commit dd10f57

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ run_script = "0.11.0"
1111
[target."cfg(windows)".dependencies]
1212
powershell_script = "1.1.0"
1313

14+
[target."cfg(windows)".dev-dependencies]
15+
winreg = "0.52.0"
16+

src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ mod tests {
135135
#![allow(clippy::unwrap_used)]
136136
use super::*;
137137

138+
/// open registry key for editing or reading.
139+
fn hklm_open_subkey(subkey: &str) -> anyhow::Result<winreg::RegKey> {
140+
let hklm = winreg::RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE);
141+
Ok(hklm.open_subkey(subkey)?)
142+
}
143+
138144
#[test]
139145
fn test_script_multiline() {
140146
let script = r#"ls $HOME
@@ -163,13 +169,13 @@ ls $TEMP
163169
#[cfg(windows)]
164170
fn test_powershell() {
165171
let out = run_powershell("ls", true).unwrap();
166-
assert!(!out.is_empty());
167-
println!("output=`{out}`");
172+
assert!(!out.stdout.is_empty());
173+
println!("output=`{out:?}`");
168174

169175
let uuid = run_powershell(
170176
r"(Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography).MachineGuid",
171177
true,
172-
).unwrap();
178+
).unwrap().stdout;
173179
assert!(!uuid.is_empty());
174180
println!("11 uuid=`{uuid}`");
175181

0 commit comments

Comments
 (0)