diff --git a/tests/cli_errors.rs b/tests/cli_errors.rs index c31f2b4c..4b7e92b0 100644 --- a/tests/cli_errors.rs +++ b/tests/cli_errors.rs @@ -4,7 +4,14 @@ pub mod _utils; pub use _utils::*; use command_extra::CommandExtra; +use pipe_trait::Pipe; +use pretty_assertions::assert_eq; +use std::process::{Command, Output, Stdio}; +use text_block_macros::text_block; + +#[cfg(unix)] use maplit::btreeset; +#[cfg(unix)] use parallel_disk_usage::{ bytes_format::BytesFormat, data_tree::DataTree, @@ -14,14 +21,8 @@ use parallel_disk_usage::{ reporter::{ErrorOnlyReporter, ErrorReport}, visualizer::{BarAlignment, ColumnWidthDistribution, Direction, Visualizer}, }; -use pipe_trait::Pipe; -use pretty_assertions::assert_eq; -use std::{ - collections::BTreeSet, - path::Path, - process::{Command, Output, Stdio}, -}; -use text_block_macros::text_block; +#[cfg(unix)] +use std::{collections::BTreeSet, path::Path}; fn stdio(command: Command) -> Command { command diff --git a/tests/data_tree_reflection.rs b/tests/data_tree_reflection.rs index 04bbe9c7..12f1ba57 100644 --- a/tests/data_tree_reflection.rs +++ b/tests/data_tree_reflection.rs @@ -136,7 +136,15 @@ fn display_excessive_children() { .par_try_into_tree() .expect_err("create error") .to_string(); - let expected = r#"ExcessiveChildren: "root/b/0" (Bytes(321)) is less than a child named "def" (Bytes(456))"#; + let expected = if cfg!(unix) { + r#"ExcessiveChildren: "root/b/0" (Bytes(321)) is less than a child named "def" (Bytes(456))"# + } else if cfg!(windows) { + // TODO: stop using debug format + r#"ExcessiveChildren: "root\\b\\0" (Bytes(321)) is less than a child named "def" (Bytes(456))"# + } else { + eprintln!("ACTUAL: {actual}"); + panic!("This platform isn't supported!"); + }; assert_eq!(actual, expected); } diff --git a/tests/fs_tree_builder.rs b/tests/fs_tree_builder.rs index df360eb2..52789662 100644 --- a/tests/fs_tree_builder.rs +++ b/tests/fs_tree_builder.rs @@ -1,13 +1,13 @@ pub mod _utils; pub use _utils::*; -use parallel_disk_usage::{ - get_size::{GetApparentSize, GetBlockCount, GetBlockSize}, - size::Bytes, -}; +use parallel_disk_usage::{get_size::GetApparentSize, size::Bytes}; #[cfg(unix)] -use parallel_disk_usage::size::Blocks; +use parallel_disk_usage::{ + get_size::{GetBlockCount, GetBlockSize}, + size::Blocks, +}; #[test] fn len_as_bytes() { diff --git a/tests/usual_cli.rs b/tests/usual_cli.rs index f9b0f3b7..d27b635f 100644 --- a/tests/usual_cli.rs +++ b/tests/usual_cli.rs @@ -8,7 +8,7 @@ use parallel_disk_usage::{ bytes_format::BytesFormat, data_tree::DataTree, fs_tree_builder::FsTreeBuilder, - get_size::{GetApparentSize, GetBlockCount, GetBlockSize}, + get_size::GetApparentSize, os_string_display::OsStringDisplay, reporter::{ErrorOnlyReporter, ErrorReport}, visualizer::{BarAlignment, ColumnWidthDistribution, Direction, Visualizer}, @@ -17,6 +17,9 @@ use pipe_trait::Pipe; use pretty_assertions::assert_eq; use std::process::{Command, Stdio}; +#[cfg(unix)] +use parallel_disk_usage::get_size::{GetBlockCount, GetBlockSize}; + fn stdio(command: Command) -> Command { command .with_stdin(Stdio::null()) @@ -443,7 +446,7 @@ fn bytes_format_plain() { let actual = Command::new(PDU) .with_current_dir(&workspace) .with_arg("--total-width=100") - .with_arg("--quantity=block-size") + .with_arg("--quantity=apparent-size") .with_arg("--bytes-format=plain") .pipe(stdio) .output() @@ -453,7 +456,7 @@ fn bytes_format_plain() { let builder = FsTreeBuilder { root: workspace.to_path_buf(), - size_getter: GetBlockSize, + size_getter: GetApparentSize, reporter: ErrorOnlyReporter::new(ErrorReport::SILENT), max_depth: 10, }; @@ -482,7 +485,7 @@ fn bytes_format_metric() { let actual = Command::new(PDU) .with_current_dir(&workspace) .with_arg("--total-width=100") - .with_arg("--quantity=block-size") + .with_arg("--quantity=apparent-size") .with_arg("--bytes-format=metric") .pipe(stdio) .output() @@ -492,7 +495,7 @@ fn bytes_format_metric() { let builder = FsTreeBuilder { root: workspace.to_path_buf(), - size_getter: GetBlockSize, + size_getter: GetApparentSize, reporter: ErrorOnlyReporter::new(ErrorReport::SILENT), max_depth: 10, }; @@ -521,7 +524,7 @@ fn bytes_format_binary() { let actual = Command::new(PDU) .with_current_dir(&workspace) .with_arg("--total-width=100") - .with_arg("--quantity=block-size") + .with_arg("--quantity=apparent-size") .with_arg("--bytes-format=binary") .pipe(stdio) .output() @@ -531,7 +534,7 @@ fn bytes_format_binary() { let builder = FsTreeBuilder { root: workspace.to_path_buf(), - size_getter: GetBlockSize, + size_getter: GetApparentSize, reporter: ErrorOnlyReporter::new(ErrorReport::SILENT), max_depth: 10, };