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

Add pre-commit hook + run fmt (#1959)

This commit is contained in:
desbma 2021-03-30 21:24:01 +02:00 committed by GitHub
parent da18ffa496
commit be03c948ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 34 deletions

View file

@ -38,10 +38,7 @@ fn test_posix_mode() {
// fail on long path
new_ucmd!()
.args(&[
"-p",
&"dir".repeat(libc::PATH_MAX as usize + 1).as_str(),
])
.args(&["-p", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()])
.fails()
.no_stdout();
@ -79,10 +76,7 @@ fn test_posix_special() {
// fail on long path
new_ucmd!()
.args(&[
"-P",
&"dir".repeat(libc::PATH_MAX as usize + 1).as_str(),
])
.args(&["-P", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()])
.fails()
.no_stdout();
@ -107,7 +101,10 @@ fn test_posix_all() {
// test the posix special mode
// accept some reasonable default
new_ucmd!().args(&["-p", "-P", "dir/file"]).succeeds().no_stdout();
new_ucmd!()
.args(&["-p", "-P", "dir/file"])
.succeeds()
.no_stdout();
// accept non-leading hyphen
new_ucmd!()
@ -136,10 +133,16 @@ fn test_posix_all() {
.no_stdout();
// fail on non-portable chars
new_ucmd!().args(&["-p", "-P", "dir#/$file"]).fails().no_stdout();
new_ucmd!()
.args(&["-p", "-P", "dir#/$file"])
.fails()
.no_stdout();
// fail on leading hyphen char
new_ucmd!().args(&["-p", "-P", "dir/-file"]).fails().no_stdout();
new_ucmd!()
.args(&["-p", "-P", "dir/-file"])
.fails()
.no_stdout();
// fail on empty path
new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout();
@ -149,8 +152,5 @@ fn test_posix_all() {
fn test_args_parsing() {
// fail on no args
let empty_args: [String; 0] = [];
new_ucmd!()
.args(&empty_args)
.fails()
.no_stdout();
}
new_ucmd!().args(&empty_args).fails().no_stdout();
}

View file

@ -177,7 +177,7 @@ fn test_rm_directory_without_flag() {
let dir = "test_rm_directory_without_flag_dir";
at.mkdir(dir);
let result = ucmd.arg(dir).fails();
println!("{}", result.stderr);
assert!(result