test powershell output too
This commit is contained in:
parent
beebbbbb3b
commit
774e72423f
2 changed files with 32 additions and 21 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -116,9 +116,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.3"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12"
|
||||
checksum = "52fb27eab85b17fbb9f6fd667089e07d6a2eb8743d02639ee7f6a7a7729c9c94"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
|
@ -129,9 +129,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49"
|
||||
checksum = "4feb231f0d4d6af81aed15928e58ecf5816aa62a2393e2c82f46973e92a9a278"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
|
@ -656,9 +656,9 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode_categories"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::findings::Findings;
|
||||
use crate::formats::{Format, Shell};
|
||||
use crate::formats::{Format, Shell, PowerShell};
|
||||
use crate::inspectors::{mime_extension_lookup, BUF_SIZE};
|
||||
use crate::mime_db::MimeDb;
|
||||
use crate::string_type::String;
|
||||
|
@ -336,12 +336,20 @@ fn outputs_move_commands() {
|
|||
mime: IMAGE_JPEG,
|
||||
})];
|
||||
|
||||
for format in ["Shell", "PowerShell"].iter() {
|
||||
let mut cursor = std::io::Cursor::new(Vec::new());
|
||||
let mut contents = std::string::String::new();
|
||||
|
||||
Shell::new()
|
||||
match *format {
|
||||
"Shell" => Shell::new()
|
||||
.write_all(&mut cursor, &entries)
|
||||
.expect("Failed to write to cursor");
|
||||
.expect("Failed to write to cursor"),
|
||||
"PowerShell" => PowerShell::new()
|
||||
.write_all(&mut cursor, &entries)
|
||||
.expect("Failed to write to cursor"),
|
||||
_ => unreachable!()
|
||||
}
|
||||
|
||||
cursor.set_position(0);
|
||||
cursor
|
||||
.read_to_string(&mut contents)
|
||||
|
@ -350,8 +358,11 @@ fn outputs_move_commands() {
|
|||
// the output should contain a command like "mv -i misnamed_file.png misnamed_file.jpg"
|
||||
assert!(
|
||||
contents.contains("misnamed_file.jpg"),
|
||||
"Output doesn't contain move command!"
|
||||
"{} output doesn't contain move command!",
|
||||
format
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue