1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

fixup! basename: handle paths comprising only slashes

This commit is contained in:
Jeffrey Finkelstein 2021-08-01 10:05:01 -04:00
parent 0d348f05f2
commit 8f5b785180

View file

@ -150,7 +150,8 @@ fn invalid_utf8_args_unix() {
#[test] #[test]
fn test_root() { fn test_root() {
new_ucmd!().arg("/").succeeds().stdout_is("/\n"); let expected = if cfg!(windows) { "\\\n" } else { "/\n" };
new_ucmd!().arg("/").succeeds().stdout_is(expected);
} }
#[test] #[test]
@ -158,7 +159,7 @@ fn test_double_slash() {
// TODO The GNU tests seem to suggest that some systems treat "//" // TODO The GNU tests seem to suggest that some systems treat "//"
// as the same directory as "/" directory but not all systems. We // as the same directory as "/" directory but not all systems. We
// should extend this test to account for that possibility. // should extend this test to account for that possibility.
let expected = if cfg!(windows) { "\\" } else { "/\n" }; let expected = if cfg!(windows) { "\\\n" } else { "/\n" };
new_ucmd!().arg("//").succeeds().stdout_is(expected); new_ucmd!().arg("//").succeeds().stdout_is(expected);
new_ucmd!() new_ucmd!()
.args(&["//", "/"]) .args(&["//", "/"])
@ -172,5 +173,6 @@ fn test_double_slash() {
#[test] #[test]
fn test_triple_slash() { fn test_triple_slash() {
new_ucmd!().arg("///").succeeds().stdout_is("/\n"); let expected = if cfg!(windows) { "\\\n" } else { "/\n" };
new_ucmd!().arg("///").succeeds().stdout_is(expected);
} }