1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 20:17:45 +00:00

Merge pull request #6144 from sylvestre/dired

ls --dired: adjust our code after GNU v9.5
This commit is contained in:
Daniel Hofstetter 2024-06-24 13:41:11 +02:00 committed by GitHub
commit 92c3de5387
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 79 additions and 17 deletions

View file

@ -3929,15 +3929,68 @@ fn test_ls_perm_io_errors() {
}
#[test]
fn test_ls_dired_incompatible() {
fn test_ls_dired_implies_long() {
let scene = TestScenario::new(util_name!());
scene
.ucmd()
.arg("--dired")
.fails()
.code_is(1)
.stderr_contains("--dired requires --format=long");
.succeeds()
.stdout_does_not_contain("//DIRED//")
.stdout_contains(" total 0")
.stdout_contains("//DIRED-OPTIONS// --quoting-style");
}
#[test]
fn test_ls_dired_hyperlink() {
// we will have link but not the DIRED output
// note that the order matters
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.mkdir("dir");
at.touch("dir/a");
scene
.ucmd()
.arg("--dired")
.arg("--hyperlink")
.arg("-R")
.succeeds()
.stdout_contains("file://")
.stdout_contains("-rw") // we should have the long output
// even if dired isn't actually run
.stdout_does_not_contain("//DIRED//");
// dired is passed after hyperlink
// so we will have DIRED output
scene
.ucmd()
.arg("--hyperlink")
.arg("--dired")
.arg("-R")
.succeeds()
.stdout_does_not_contain("file://")
.stdout_contains("//DIRED//");
}
#[test]
fn test_ls_dired_order_format() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.mkdir("dir");
at.touch("dir/a");
scene
.ucmd()
.arg("--dired")
.arg("--format=vertical")
.arg("-R")
.succeeds()
.stdout_does_not_contain("//DIRED//");
scene
.ucmd()
.arg("--format=vertical")
.arg("--dired")
.arg("-R")
.succeeds()
.stdout_contains("//DIRED//");
}
#[test]