Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions tests/cli_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
10 changes: 9 additions & 1 deletion tests/data_tree_reflection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
10 changes: 5 additions & 5 deletions tests/fs_tree_builder.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
17 changes: 10 additions & 7 deletions tests/usual_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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())
Expand Down Expand Up @@ -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()
Expand All @@ -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,
};
Expand Down Expand Up @@ -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()
Expand All @@ -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,
};
Expand Down Expand Up @@ -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()
Expand All @@ -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,
};
Expand Down
Loading