From 739fe376c46a0cd204b3f7830139659849913f5c Mon Sep 17 00:00:00 2001 From: Benjamin Nguyen Date: Tue, 25 Apr 2023 00:27:33 -0400 Subject: [PATCH] update tests --- src/render/context/mod.rs | 1 - src/render/disk_usage/file_size.rs | 39 ++++----- src/render/tree/mod.rs | 14 +++- src/render/tree/node/display/presenters.rs | 4 +- tests/dirs_only.rs | 10 +-- tests/flat.rs | 66 +++++++--------- tests/glob.rs | 92 +++++++--------------- tests/hardlink.rs | 10 +-- tests/level.rs | 16 ++-- tests/prune.rs | 26 +++--- tests/regex.rs | 65 +++++---------- tests/sort.rs | 80 +++++++++---------- tests/suppress_size.rs | 20 ++--- tests/symlink.rs | 6 +- tests/utils/mod.rs | 4 +- 15 files changed, 197 insertions(+), 256 deletions(-) diff --git a/src/render/context/mod.rs b/src/render/context/mod.rs index 828c14b5..7f364f5a 100644 --- a/src/render/context/mod.rs +++ b/src/render/context/mod.rs @@ -141,7 +141,6 @@ pub struct Context { #[arg(long, requires = "hidden")] pub no_git: bool, - #[arg(long)] /// Print completions for a given shell to stdout pub completions: Option, diff --git a/src/render/disk_usage/file_size.rs b/src/render/disk_usage/file_size.rs index 4b152966..393019ab 100644 --- a/src/render/disk_usage/file_size.rs +++ b/src/render/disk_usage/file_size.rs @@ -1,10 +1,9 @@ use super::units::{BinPrefix, PrefixKind, SiPrefix, UnitPrefix}; -use ansi_term::Style; use crate::{ render::styles::{self, get_du_theme, get_placeholder_style}, - Context, - utils, + utils, Context, }; +use ansi_term::Style; use clap::ValueEnum; use filesize::PathExt; use std::{borrow::Cow, fs::Metadata, ops::AddAssign, path::Path}; @@ -79,11 +78,13 @@ impl FileSize { } pub fn unpadded_display(&self) -> Option<&str> { - self.unpadded_display.as_ref().map(String::as_str) + self.unpadded_display.as_deref() } /// Precompute the raw (unpadded) display and sets the number of columns the size (without /// the prefix) will occupy. Also sets the [Color] to use in advance to style the size output. + #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_sign_loss)] pub fn precompute_unpadded_display(&mut self) { let fbytes = self.bytes as f64; @@ -105,11 +106,11 @@ impl FileSize { self.size_columns = utils::num_integral((size * 100.0).floor() as u64) + 1; } - if let Some(theme) = get_du_theme().ok() { + if let Ok(theme) = get_du_theme() { let style = theme.get(format!("{unit}").as_str()); self.style = style; } - }, + } PrefixKind::Bin => { let unit = BinPrefix::from(fbytes); let base_value = unit.base_value(); @@ -127,11 +128,11 @@ impl FileSize { self.size_columns = utils::num_integral((size * 100.0).floor() as u64) + 1; } - if let Some(theme) = get_du_theme().ok() { + if let Ok(theme) = get_du_theme() { let style = theme.get(format!("{unit}").as_str()); self.style = style; } - }, + } } } @@ -147,12 +148,12 @@ impl FileSize { }; if self.uses_base_unit.is_some() { - format!("{:>width$} {unit:>unit_padding$}", self.bytes, width = max_size_width) + format!("{:>max_size_width$} {unit:>unit_padding$}", self.bytes) } else { - format!("{size:>width$} {unit:>unit_padding$}", width = max_size_width) + format!("{size:>max_size_width$} {unit:>unit_padding$}") } } else { - format!("{: String { if ctx.suppress_size || ctx.max_du_width == 0 { - return String::new() + return String::new(); } let placeholder = get_placeholder_style().map_or_else( @@ -173,12 +174,14 @@ impl FileSize { |style| Cow::from(style.paint(styles::PLACEHOLDER).to_string()), ); - let placeholder_padding = placeholder.len() + ctx.max_du_width + match ctx.unit { - PrefixKind::Si if ctx.human => 2, - PrefixKind::Bin if ctx.human => 3, - PrefixKind::Si => 0, - PrefixKind::Bin => 1, - }; + let placeholder_padding = placeholder.len() + + ctx.max_du_width + + match ctx.unit { + PrefixKind::Si if ctx.human => 2, + PrefixKind::Bin if ctx.human => 3, + PrefixKind::Si => 0, + PrefixKind::Bin => 1, + }; format!("{placeholder:>placeholder_padding$}") } diff --git a/src/render/tree/mod.rs b/src/render/tree/mod.rs index fe19e073..3c9035f3 100644 --- a/src/render/tree/mod.rs +++ b/src/render/tree/mod.rs @@ -226,7 +226,15 @@ where }; if is_dir { - Self::assemble_tree(tree, index, branches, node_comparator, inode_set, size_columns, ctx); + Self::assemble_tree( + tree, + index, + branches, + node_comparator, + inode_set, + size_columns, + ctx, + ); } let node = tree[index].get(); @@ -244,7 +252,7 @@ where let file_size_cols = file_size.size_columns; if file_size_cols > *size_columns { - *size_columns = file_size_cols + *size_columns = file_size_cols; } } } @@ -257,7 +265,7 @@ where let dir_size_cols = dir_size.size_columns; if dir_size_cols > *size_columns { - *size_columns = dir_size_cols + *size_columns = dir_size_cols; } node.set_file_size(dir_size); diff --git a/src/render/tree/node/display/presenters.rs b/src/render/tree/node/display/presenters.rs index f62aa528..9ae59374 100644 --- a/src/render/tree/node/display/presenters.rs +++ b/src/render/tree/node/display/presenters.rs @@ -1,6 +1,4 @@ -use crate::render::{ - context::Context, disk_usage::file_size::FileSize, tree::Node, -}; +use crate::render::{context::Context, disk_usage::file_size::FileSize, tree::Node}; use std::borrow::Cow; #[cfg(unix)] diff --git a/tests/dirs_only.rs b/tests/dirs_only.rs index 66918085..c1804e2c 100644 --- a/tests/dirs_only.rs +++ b/tests/dirs_only.rs @@ -7,12 +7,12 @@ fn dirs_only() { assert_eq!( utils::run_cmd(&["--dirs-only", "--sort", "name", "tests/data"]), indoc!( - "1.21 KiB data - 308 B ├─ dream_cycle - 446 B ├─ lipsum - 143 B └─ the_yellow_king + "143 B ┌─ the_yellow_king + 446 B ├─ lipsum + 308 B ├─ dream_cycle + 1241 B data - 3 directories" + 3 directories" ) ) } diff --git a/tests/flat.rs b/tests/flat.rs index a39995cf..dd75ac5f 100644 --- a/tests/flat.rs +++ b/tests/flat.rs @@ -5,20 +5,20 @@ mod utils; #[test] fn flat() { assert_eq!( - utils::run_cmd(&["--flat", "--sort", "name", "tests/data"]), + utils::run_cmd(&["--flat", "tests/data"]), indoc!( "1241 B data - 308 B dream_cycle - 308 B dream_cycle/polaris.txt - 446 B lipsum - 446 B lipsum/lipsum.txt - 83 B necronomicon.txt - 161 B nemesis.txt - 100 B nylarlathotep.txt - 143 B the_yellow_king - 143 B the_yellow_king/cassildas_song.md + 308 B dream_cycle + 308 B dream_cycle/polaris.txt + 446 B lipsum + 446 B lipsum/lipsum.txt + 83 B necronomicon.txt + 161 B nemesis.txt + 100 B nylarlathotep.txt + 143 B the_yellow_king + 143 B the_yellow_king/cassildas_song.md - 3 directories, 6 files" + 3 directories, 6 files" ) ) } @@ -26,20 +26,20 @@ fn flat() { #[test] fn flat_human() { assert_eq!( - utils::run_cmd(&["--flat", "--human", "--sort", "name", "tests/data"]), + utils::run_cmd(&["--flat", "--human", "tests/data"]), indoc!( "1.21 KiB data - 308 B dream_cycle - 308 B dream_cycle/polaris.txt - 446 B lipsum - 446 B lipsum/lipsum.txt - 83 B necronomicon.txt - 161 B nemesis.txt - 100 B nylarlathotep.txt - 143 B the_yellow_king - 143 B the_yellow_king/cassildas_song.md + 308 B dream_cycle + 308 B dream_cycle/polaris.txt + 446 B lipsum + 446 B lipsum/lipsum.txt + 83 B necronomicon.txt + 161 B nemesis.txt + 100 B nylarlathotep.txt + 143 B the_yellow_king + 143 B the_yellow_king/cassildas_song.md - 3 directories, 6 files" + 3 directories, 6 files" ) ) } @@ -47,27 +47,21 @@ fn flat_human() { #[test] fn flat_with_level() { assert_eq!( - utils::run_cmd(&["--flat", "--level", "1", "--sort", "name", "tests/data"]), + utils::run_cmd(&["--flat", "--level", "1", "tests/data"]), indoc!( "1241 B data - 308 B dream_cycle - 446 B lipsum - 83 B necronomicon.txt - 161 B nemesis.txt - 100 B nylarlathotep.txt - 143 B the_yellow_king + 308 B dream_cycle + 446 B lipsum + 83 B necronomicon.txt + 161 B nemesis.txt + 100 B nylarlathotep.txt + 143 B the_yellow_king - 3 directories, 6 files" + 3 directories, 6 files" ) ) } -#[test] -#[should_panic] -fn flat_requires_human() { - utils::run_cmd(&["--human"]); -} - #[test] #[should_panic] fn flat_requires_file_name() { diff --git a/tests/glob.rs b/tests/glob.rs index af9eb56a..272d56c1 100644 --- a/tests/glob.rs +++ b/tests/glob.rs @@ -5,25 +5,18 @@ mod utils; #[test] fn glob() { assert_eq!( - utils::run_cmd(&[ - "--sort", - "name", - "--glob", - "--pattern", - "*.txt", - "tests/data" - ]), + utils::run_cmd(&["--glob", "--pattern", "*.txt", "tests/data"]), indoc!( - "1.07 KiB data - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B ├─ lipsum - 446 B │ └─ lipsum.txt - 83 B ├─ necronomicon.txt - 161 B ├─ nemesis.txt - 100 B └─ nylarlathotep.txt + "100 B ┌─ nylarlathotep.txt + 161 B ├─ nemesis.txt + 83 B ├─ necronomicon.txt + 446 B │ ┌─ lipsum.txt + 446 B ├─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 1098 B data - 2 directories, 5 files" + 2 directories, 5 files" ) ); } @@ -31,20 +24,13 @@ fn glob() { #[test] fn glob_negative() { assert_eq!( - utils::run_cmd(&[ - "--sort", - "name", - "--glob", - "--pattern", - "!*.txt", - "tests/data" - ]), + utils::run_cmd(&["--glob", "--pattern", "!*.txt", "tests/data"]), indoc!( - "143 B data - 143 B └─ the_yellow_king - 143 B └─ cassildas_song.md + "143 B ┌─ cassildas_song.md + 143 B ┌─ the_yellow_king + 143 B data - 1 directory, 1 file" + 1 directory, 1 file" ) ) } @@ -52,25 +38,18 @@ fn glob_negative() { #[test] fn glob_case_insensitive() { assert_eq!( - utils::run_cmd(&[ - "--sort", - "name", - "--iglob", - "--pattern", - "*.TXT", - "tests/data" - ]), + utils::run_cmd(&["--iglob", "--pattern", "*.TXT", "tests/data"]), indoc!( - "1.07 KiB data - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B ├─ lipsum - 446 B │ └─ lipsum.txt - 83 B ├─ necronomicon.txt - 161 B ├─ nemesis.txt - 100 B └─ nylarlathotep.txt + "100 B ┌─ nylarlathotep.txt + 161 B ├─ nemesis.txt + 83 B ├─ necronomicon.txt + 446 B │ ┌─ lipsum.txt + 446 B ├─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 1098 B data - 2 directories, 5 files" + 2 directories, 5 files" ) ) } @@ -79,8 +58,6 @@ fn glob_case_insensitive() { fn glob_with_filetype() { assert_eq!( utils::run_cmd(&[ - "--sort", - "name", "--glob", "--pattern", "dream*", @@ -89,11 +66,11 @@ fn glob_with_filetype() { "tests/data" ]), indoc!( - "308 B data - 308 B └─ dream_cycle - 308 B └─ polaris.txt + "308 B ┌─ polaris.txt + 308 B ┌─ dream_cycle + 308 B data - 1 directory, 1 file" + 1 directory, 1 file" ) ) } @@ -102,8 +79,6 @@ fn glob_with_filetype() { #[should_panic] fn glob_empty_set_dir() { utils::run_cmd(&[ - "--sort", - "name", "--glob", "--pattern", "*.txt", @@ -116,12 +91,5 @@ fn glob_empty_set_dir() { #[test] #[should_panic] fn glob_empty_set_file() { - utils::run_cmd(&[ - "--sort", - "name", - "--glob", - "--pattern", - "*weewoo*", - "tests/data", - ]); + utils::run_cmd(&["--glob", "--pattern", "*weewoo*", "tests/data"]); } diff --git a/tests/hardlink.rs b/tests/hardlink.rs index ddb64488..240f035e 100644 --- a/tests/hardlink.rs +++ b/tests/hardlink.rs @@ -19,18 +19,18 @@ fn hardlink() -> Result<(), Box> { fs::hard_link(&src, &link)?; - let out = utils::run_cmd(&["--sort", "name", "tests/hardlinks"]); + let out = utils::run_cmd(&["tests/hardlinks"]); fs::remove_file(&link)?; assert_eq!( out, indoc!( - "157 B hardlinks - 157 B ├─ curwin.hpl - 157 B └─ kadath.txt + "157 B ┌─ kadath.txt + 157 B ├─ curwin.hpl + 157 B hardlinks - 2 files" + 2 files" ) ); diff --git a/tests/level.rs b/tests/level.rs index d7295183..f3d9cfd5 100644 --- a/tests/level.rs +++ b/tests/level.rs @@ -5,15 +5,15 @@ mod utils; #[test] fn level() { assert_eq!( - utils::run_cmd(&["--sort", "name", "--level", "1", "tests/data"]), + utils::run_cmd(&["--level", "1", "tests/data"]), indoc!( - "1.21 KiB data - 308 B ├─ dream_cycle - 446 B ├─ lipsum - 83 B ├─ necronomicon.txt - 161 B ├─ nemesis.txt - 100 B ├─ nylarlathotep.txt - 143 B └─ the_yellow_king + "143 B ┌─ the_yellow_king + 100 B ├─ nylarlathotep.txt + 161 B ├─ nemesis.txt + 83 B ├─ necronomicon.txt + 446 B ├─ lipsum + 308 B ├─ dream_cycle + 1241 B data 3 directories, 6 files" ), diff --git a/tests/prune.rs b/tests/prune.rs index 25a71e86..139d87df 100644 --- a/tests/prune.rs +++ b/tests/prune.rs @@ -5,24 +5,16 @@ mod utils; #[test] fn prune() { assert_eq!( - utils::run_cmd(&[ - "--sort", - "name", - "--glob", - "--pattern", - "*.txt", - "--prune", - "tests/data" - ]), + utils::run_cmd(&["--glob", "--pattern", "*.txt", "--prune", "tests/data"]), indoc!( - "1.07 KiB data - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B ├─ lipsum - 446 B │ └─ lipsum.txt - 83 B ├─ necronomicon.txt - 161 B ├─ nemesis.txt - 100 B └─ nylarlathotep.txt + "100 B ┌─ nylarlathotep.txt + 161 B ├─ nemesis.txt + 83 B ├─ necronomicon.txt + 446 B │ ┌─ lipsum.txt + 446 B ├─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 1098 B data 2 directories, 5 files" ) diff --git a/tests/regex.rs b/tests/regex.rs index 22e42f19..64a7ef3b 100644 --- a/tests/regex.rs +++ b/tests/regex.rs @@ -5,34 +5,27 @@ mod utils; #[test] fn regex() { assert_eq!( - utils::run_cmd(&["--sort", "name", "--pattern", r"\.txt$", "tests/data"]), + utils::run_cmd(&["--pattern", r"\.txt$", "tests/data"]), indoc!( - "1.07 KiB data - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B ├─ lipsum - 446 B │ └─ lipsum.txt - 83 B ├─ necronomicon.txt - 161 B ├─ nemesis.txt - 100 B └─ nylarlathotep.txt + "100 B ┌─ nylarlathotep.txt + 161 B ├─ nemesis.txt + 83 B ├─ necronomicon.txt + 446 B │ ┌─ lipsum.txt + 446 B ├─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 1098 B data - 2 directories, 5 files" + 2 directories, 5 files" ) ); assert_eq!( - utils::run_cmd(&[ - "--sort", - "name", - "--pattern", - r"^cassildas.", - "--prune", - "tests/data" - ]), + utils::run_cmd(&["--pattern", r"^cassildas.", "--prune", "tests/data"]), indoc!( - "143 B data - 143 B └─ the_yellow_king - 143 B └─ cassildas_song.md + "143 B ┌─ cassildas_song.md + 143 B ┌─ the_yellow_king + 143 B data 1 directory, 1 file" ) @@ -42,21 +35,13 @@ fn regex() { #[test] fn regex_file_type() { assert_eq!( - utils::run_cmd(&[ - "--sort", - "name", - "--pattern", - r"^dream.", - "--file-type", - "dir", - "tests/data" - ]), + utils::run_cmd(&["--pattern", r"^dream.", "--file-type", "dir", "tests/data"]), indoc!( - "308 B data - 308 B └─ dream_cycle - 308 B └─ polaris.txt + "308 B ┌─ polaris.txt + 308 B ┌─ dream_cycle + 308 B data - 1 directory, 1 file" + 1 directory, 1 file" ) ); } @@ -66,15 +51,7 @@ fn regex_file_type() { fn regex_empty_set_dir() { // Trying to look for a regular file when file type is specified to be directory should result // in an empty set which causes `main` to return an error. - utils::run_cmd(&[ - "--sort", - "name", - "--pattern", - r"\.md$", - "--file-type", - "dir", - "tests/data", - ]); + utils::run_cmd(&["--pattern", r"\.md$", "--file-type", "dir", "tests/data"]); } #[should_panic] @@ -82,7 +59,7 @@ fn regex_empty_set_dir() { fn regex_empty_set_file() { // Trying to look for a regular file when file type is specified to be directory should result // in an empty set which causes `main` to return an error. - utils::run_cmd(&["--sort", "name", "--pattern", "weewoo", "tests/data"]); + utils::run_cmd(&["--pattern", "weewoo", "tests/data"]); } #[should_panic] diff --git a/tests/sort.rs b/tests/sort.rs index 3b7a6e9f..5cb7e46c 100644 --- a/tests/sort.rs +++ b/tests/sort.rs @@ -7,16 +7,16 @@ fn sort_name() { assert_eq!( utils::run_cmd(&["--sort", "name", "tests/data"]), indoc!( - "1.21 KiB data - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B ├─ lipsum - 446 B │ └─ lipsum.txt - 83 B ├─ necronomicon.txt - 161 B ├─ nemesis.txt - 100 B ├─ nylarlathotep.txt - 143 B └─ the_yellow_king - 143 B └─ cassildas_song.md + "143 B ┌─ cassildas_song.md + 143 B ┌─ the_yellow_king + 100 B ├─ nylarlathotep.txt + 161 B ├─ nemesis.txt + 83 B ├─ necronomicon.txt + 446 B │ ┌─ lipsum.txt + 446 B ├─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 1241 B data 3 directories, 6 files" ), @@ -29,16 +29,16 @@ fn sort_name_dir_first() { assert_eq!( utils::run_cmd(&["--sort", "name", "--dirs-first", "tests/data"]), indoc!( - "1.21 KiB data - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B ├─ lipsum - 446 B │ └─ lipsum.txt - 143 B ├─ the_yellow_king - 143 B │ └─ cassildas_song.md - 83 B ├─ necronomicon.txt - 161 B ├─ nemesis.txt - 100 B └─ nylarlathotep.txt + "100 B ┌─ nylarlathotep.txt + 161 B ├─ nemesis.txt + 83 B ├─ necronomicon.txt + 143 B │ ┌─ cassildas_song.md + 143 B ├─ the_yellow_king + 446 B │ ┌─ lipsum.txt + 446 B ├─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 1241 B data 3 directories, 6 files" ), @@ -51,16 +51,16 @@ fn sort_size() { assert_eq!( utils::run_cmd(&["--sort", "size-rev", "tests/data"]), indoc!( - "1.21 KiB data - 83 B ├─ necronomicon.txt - 100 B ├─ nylarlathotep.txt - 143 B ├─ the_yellow_king - 143 B │ └─ cassildas_song.md - 161 B ├─ nemesis.txt - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B └─ lipsum - 446 B └─ lipsum.txt + "446 B ┌─ lipsum.txt + 446 B ┌─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 161 B ├─ nemesis.txt + 143 B │ ┌─ cassildas_song.md + 143 B ├─ the_yellow_king + 100 B ├─ nylarlathotep.txt + 83 B ├─ necronomicon.txt + 1241 B data 3 directories, 6 files" ), @@ -73,16 +73,16 @@ fn sort_size_dir_first() { assert_eq!( utils::run_cmd(&["--sort", "size-rev", "--dirs-first", "tests/data"]), indoc!( - "1.21 KiB data - 143 B ├─ the_yellow_king - 143 B │ └─ cassildas_song.md - 308 B ├─ dream_cycle - 308 B │ └─ polaris.txt - 446 B ├─ lipsum - 446 B │ └─ lipsum.txt - 83 B ├─ necronomicon.txt - 100 B ├─ nylarlathotep.txt - 161 B └─ nemesis.txt + "161 B ┌─ nemesis.txt + 100 B ├─ nylarlathotep.txt + 83 B ├─ necronomicon.txt + 446 B │ ┌─ lipsum.txt + 446 B ├─ lipsum + 308 B │ ┌─ polaris.txt + 308 B ├─ dream_cycle + 143 B │ ┌─ cassildas_song.md + 143 B ├─ the_yellow_king + 1241 B data 3 directories, 6 files" ), diff --git a/tests/suppress_size.rs b/tests/suppress_size.rs index 04e6d453..c771bf7d 100644 --- a/tests/suppress_size.rs +++ b/tests/suppress_size.rs @@ -5,18 +5,18 @@ mod utils; #[test] fn suppress_size() { assert_eq!( - utils::run_cmd(&["--suppress-size", "--sort", "name", "tests/data"]), + utils::run_cmd(&["--suppress-size", "tests/data"]), indoc!( - "data - ├─ dream_cycle - │ └─ polaris.txt - ├─ lipsum - │ └─ lipsum.txt - ├─ necronomicon.txt - ├─ nemesis.txt + "┌─ cassildas_song.md + ┌─ the_yellow_king ├─ nylarlathotep.txt - └─ the_yellow_king - └─ cassildas_song.md + ├─ nemesis.txt + ├─ necronomicon.txt + │ ┌─ lipsum.txt + ├─ lipsum + │ ┌─ polaris.txt + ├─ dream_cycle + data 3 directories, 6 files" ), diff --git a/tests/symlink.rs b/tests/symlink.rs index ac7b258f..5ce32b47 100644 --- a/tests/symlink.rs +++ b/tests/symlink.rs @@ -21,11 +21,13 @@ mod test { let out = super::utils::run_cmd(&["--sort", "name", "--follow", &link_canonical]); + println!("{}", out); + assert_eq!( out, indoc!( - "143 B the_yellow_king - 143 B └─ cassildas_song.md + "143 B ┌─ cassildas_song.md + 143 B the_yellow_king 1 file" ), diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs index 528a596d..5d5bf391 100644 --- a/tests/utils/mod.rs +++ b/tests/utils/mod.rs @@ -11,9 +11,9 @@ pub fn run_cmd(args: &[&str]) -> String { "1", "--disk-usage", "logical", + "--sort", + "name", "--no-config", - "--inverted", - "--human", ]); for arg in args {