mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
ls: Fix error message for ls file/missing-file
This commit is contained in:
@@ -22,6 +22,7 @@ ls-error-cannot-open-directory-bad-descriptor = cannot open directory {$path}: B
|
||||
ls-error-unknown-io-error = unknown io error: {$path}, '{$error}'
|
||||
ls-error-invalid-block-size = invalid --block-size argument {$size}
|
||||
ls-error-dired-and-zero-incompatible = --dired and --zero are incompatible
|
||||
ls-error-not-directory = cannot access {$path}: Not a directory
|
||||
ls-error-not-listing-already-listed = {$path}: not listing already-listed directory
|
||||
ls-error-invalid-time-style = invalid --time-style argument {$style}
|
||||
Possible values are:
|
||||
|
||||
@@ -68,6 +68,7 @@ enum LsError {
|
||||
IOError(#[from] std::io::Error),
|
||||
|
||||
#[error("{}", match .1.kind() {
|
||||
ErrorKind::NotADirectory => translate!("ls-error-not-directory", "path" => .0.quote()),
|
||||
ErrorKind::NotFound => translate!("ls-error-cannot-access-no-such-file", "path" => .0.quote()),
|
||||
ErrorKind::PermissionDenied => match .1.raw_os_error().unwrap_or(1) {
|
||||
1 => translate!("ls-error-cannot-access-operation-not-permitted", "path" => .0.quote()),
|
||||
|
||||
@@ -57,6 +57,20 @@ const COMMA_ARGS: &[&str] = &["-m", "--format=commas", "--for=commas"];
|
||||
|
||||
const COLUMN_ARGS: &[&str] = &["-C", "--format=columns", "--for=columns"];
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_directory_in_file() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch("file");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("file/missing")
|
||||
.fails_with_code(2)
|
||||
.stderr_is("ls: cannot access 'file/missing': Not a directory\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_flag() {
|
||||
new_ucmd!()
|
||||
|
||||
Reference in New Issue
Block a user