From 7c7d622d540449cc77e9adf84ee6c32dcb73e30b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 18 May 2021 02:00:16 +0200 Subject: [PATCH] tests: add test for issue #2223 --- tests/by-util/test_ls.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index a57525e4b..8d32172b0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1966,3 +1966,38 @@ fn test_ls_sort_extension() { expected, ); } + +// This tests for the open issue described in #2223 +#[cfg_attr(not(feature = "test_unimplemented"), ignore)] +#[test] +fn test_ls_path() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file1 = "file1"; + let file2 = "file2"; + let dir = "dir"; + let path = &format!("{}/{}", dir, file2); + + at.mkdir(dir); + at.touch(file1); + at.touch(path); + + let expected_stdout = &format!("{}\n", path); + scene.ucmd().arg(path).run().stdout_is(expected_stdout); + + let expected_stdout = &format!("./{}\n", path); + scene.ucmd().arg(path).run().stdout_is(expected_stdout); + + let abs_path = format!("{}/{}\n", at.as_string(), path); + println!(":{}", abs_path); + scene.ucmd().arg(&abs_path).run().stdout_is(&abs_path); + + let expected_stdout = &format!("{}\n{}\n", file1, path); + scene + .ucmd() + .arg(file1) + .arg(path) + .run() + .stdout_is(expected_stdout); +}