Skip to content
Open
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
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ time = { version = "0.3.36" }
unicode-width = "0.2.0"
unit-prefix = "0.5"
utmp-classic = "0.1.6"
uutils_term_grid = "0.7"
uutils_term_grid = "0.8"
walkdir = "2.5"
winapi-util = "0.1.8"
windows-sys = { version = "0.61.0", default-features = false }
Expand Down
38 changes: 38 additions & 0 deletions tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,44 @@ fn test_ls_across() {
}
}

#[test]
fn test_ls_across_single_row() {
// Regression test: uutils_term_grid had an off-by-one bug where the column-search
// loop used `..cells.len()` (exclusive) instead of `..=cells.len()` (inclusive),
// preventing it from ever trying to fit all items on one row.
// See: https://github.com/uutils/uutils-term-grid/pull/57
// https://github.com/eza-community/eza/issues/1738
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
for name in &[
"code",
"Desktop",
"Documents",
"Downloads",
"Music",
"Pictures",
"Public",
"Templates",
"Videos",
] {
at.touch(name);
}

// With width=96 and LC_ALL=C sort order all 9 entries (79 chars total) fit on one line.
// GNU ls produces: "Desktop Documents Downloads Music Pictures Public Templates Videos code"
for option in ACROSS_ARGS {
scene
.ucmd()
.env("LC_ALL", "C")
.arg(option)
.arg("--width=96")
.succeeds()
.stdout_only(
"Desktop\t Documents Downloads Music Pictures\tPublic\tTemplates Videos code\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GNU ls doesn't seem to use tabs:

$ tabs 16
$ LC_ALL=C ls --width=96 ../playground/ls_11264/                                                                                         
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  code
$ LC_ALL=C cargo run -q ls --width=96 ../playground/ls_11264/
Desktop          Documents  Downloads  Music  Pictures          Public          Templates  Videos  code

);
}
}

#[test]
fn test_ls_commas() {
let scene = TestScenario::new(util_name!());
Expand Down
Loading