Commit graph

51 commits

Author SHA1 Message Date
Anirban Halder
a16630fded
rm: fix the usage of '/..' '/.' with -rf options
fix the test tests/rm/r-4

---------

Co-authored-by: Julian Beltz <MJayBeltz@gmail.com>
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-12-03 22:51:03 +01:00
Ben Wiederhake
42b3baf32f clippy: simplify code according to nightly 'needless_borrows_for_generic_args' lint
https://rust-lang.github.io/rust-clippy/master/index.html#/needless_borrows_for_generic_args
2024-07-18 15:59:36 +02:00
n4n5
ab67947321
fix clippy tests 2024-06-30 16:27:08 +02:00
Daniel Hofstetter
74bcfff3e8 rm: add test for "rm .\dir\ -rf" on Windows
https://github.com/uutils/coreutils/issues/3200
2024-01-28 16:36:55 +01:00
Sylvestre Ledru
505ef714b9 rm: In some cases, remove_dir is doing a better job than remove_dir_all
use it when remove_dir_all failed

GNU compatibility (rm/empty-inacc.sh)
2023-10-14 12:09:27 +02:00
Sylvestre Ledru
0b9c829bce
Merge pull request #5182 from sylvestre/clippy_
Fix some of the recent clippy warnings
2023-08-21 16:21:02 -04:00
Sylvestre Ledru
bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Sylvestre Ledru
7c9f4ba92a Fix some clippy warnings 2023-08-21 08:41:40 +02:00
John Shin
421b2f2581 rm: test prompts when --interactive is once 2023-05-22 21:27:43 -07:00
John Shin
eeb3341101 rm: add tests for --interactive with empty when 2023-05-22 21:23:44 -07:00
Jed Denlea
db5696f64b rm: support non-UTF-8 paths
Addresses #4868.
2023-05-17 23:01:21 -07:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Daniel Hofstetter
f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01:00
Joining7943
1fadeb43b2 tests/util: Do not trim stderr in CmdResult::stderr_is. Add method stderr_trimmed_is.
Fix tests assert whitespace instead of trimming it. Disable some tests in `test_tr` because `tr`
produces too many newlines.
2023-01-22 14:56:19 +01:00
Joining7943
37e06edadc tests/util: Introduce CmdResult::stdout_str_apply ... to preprocess stdout, stderr before asserting 2023-01-22 14:48:23 +01:00
Roy Ivy III
d78e1e7399 tests: revise/standardize usage error testing (for dd, install, mktemp, rm, seq, and touch) 2023-01-13 22:14:48 -06:00
Joining7943
9b35c5d5c1 tests/util: Use Stdio::null as default in UCommand for Child stdin instead of Stdio::piped 2023-01-03 16:30:08 +01:00
Terts Diepraam
ea8085e2ca rm: add test for #4246 2022-12-29 16:15:41 +01:00
Joining7943
4f54eedb74 tests/util: Improve UChild. Cleanup redundant functions in util.rs.
A short summary of changes:

* Add some basic tests for UChild and the run methods.
* Try more often in a fixed interval to create the tempfile for CapturedOutput.
* Fix drop order of struct fields for better cleanup of temporary files/dirs.
* Mark UChild::wait_with_output and UChild::pipe_in_and_wait_with_output deprecated
* Make CapturedOutput private
* Panic in stdout_all, stdout_all_bytes etc. if output is not captured.
* Rename some methods, refactor, clean up, fix documentation, add try_... methods
2022-12-02 08:06:48 +01:00
Joining7943
982fb682e9 tests: Use UChild in tests. Rename run_no_wait_child to run_no_wait and return UChild
tests/tail:
* test_stdin_redirect_file:. Test fails now when assert_alive()!
The follow test `tail -f < file` where file's content is `foo` fails with:
    Assertion failed. Expected 'tail' to be running but exited with status=exit status: 0

I also tried on the command line and can confirm that tail isn't runnning when following by
descriptor. The test is deactivated until the implementation is fixed.

* test_follow_stdin_descriptor
* test_follow_stdin_explicit_indefinitely.
* test_follow_single
* test_follow_non_utf8_bytes
* test_follow_multiple
* test_follow_name_multiple
* test_follow_invalid_pid
* test_single_big_args
* test_retry3
* test_retry4
* test_retry5
* test_retry7
* test_retry8
* test_retry9
* test_follow_descriptor_vs_rename1
* test_follow_descriptor_vs_rename2
* test_follow_name_retry_headers
* test_follow_name_remove
* test_follow_name_truncate1
* test_follow_name_truncate2
* test_follow_name_truncate3
* test_follow_name_truncate4
* test_follow_truncate_fast
* test_follow_name_move_create1
* test_follow_name_move_create2
* test_follow_name_move1
* test_follow_name_move2
* test_follow_name_move_retry1
* test_follow_name_move_retry2
* test_follow_inotify_only_regular
* test_fifo
* test_illegal_seek

tests/cat:
* test_dev_full
* test_dev_full_show_all
* test_dev_random
* test_fifo_symlink

tests/dd:
* test_random_73k_test_lazy_fullblock
* test_sync_delayed_reader

tests/factor:
* test_parallel

tests/rm:
* test_rm_force_prompts_order
* test_rm_descend_directory
* test_rm_prompts

tests/seq:
* the helper run method

tests/sort:
* test_sigpipe_panic

tests/tee:
* the helper run_tee method

tests/tty:
* test_tty module

tests/yes:
* the helper run method
2022-12-02 08:06:45 +01:00
Terts Diepraam
33cbc94f25 rm: use uucore::prompt_yes over custom prompt function 2022-11-17 15:12:18 +01:00
Pat Laster
0507270f90 Clippy is going to be the death of me 2022-10-13 20:03:35 -05:00
Pat Laster
70bf4f36a0 Added test to check rm force prompts order 2022-10-13 20:03:35 -05:00
Pat Laster
6245029445 rm: rm3 now passes 2022-10-13 20:03:35 -05:00
Pat Laster
493a2628d2
rm: Added descend messages for interactive mode Fixes #3817 (#3931)
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2022-10-05 13:35:31 +02:00
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Stefin
4c1c9ebf89 rm: change InteractiveMode::Default to InteractiveMode::PromptProtected
Signed-off-by: Stefin <stefin@pm.me>
2022-08-27 19:38:10 +05:30
Stefin
ad4eac867f rm: added test for rm_prompt_write_protected
Signed-off-by: Stefin <stefin@pm.me>
2022-08-23 21:17:48 +05:30
Niyaz Nigmatullin
028c08cce2 tests/rm: add test for issue #3722 2022-07-17 23:34:04 +03:00
Sylvestre Ledru
02cc67c915 rm: rename none by --interactive=never to fix ../gnu/tests/rm/i-never.sh 2022-04-03 09:15:45 +02:00
Terts Diepraam
270a6ee83e rm: fix 3 leading hyphens for ---presume-input-tty 2022-01-18 12:54:50 +01:00
Terts Diepraam
283973c5bf rm: clap 3 2022-01-11 19:16:48 +01:00
Jeffrey Finkelstein
f6305e2a3e rm: return UResult from uumain() function 2021-12-29 15:57:55 -05:00
Hanif Bin Ariffin
7baa05b2db Add tests for silently accepting presume-input-tty
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-11-04 17:04:26 +08:00
Kevin Burke
3e1c5c2d99
rm: allow -r flag to be specified multiple times
GNU rm allows the `-r` flag to be specified multiple times, but
uutils/coreutils would previously exit with an error.

I encountered this while attempting to run `make clean` on the
Postgres source tree (github.com/postgres/postgres).

Updates #1663.
2021-10-28 22:47:07 -07:00
Roy Ivy III
4da46d93c7 tests ~ fix tests for new execution_phrase!() and usage phrasing 2021-08-14 14:01:34 +02:00
Roy Ivy III
3f35e0a421 refactor ~ cargo make format 2021-05-31 08:23:58 -05:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Yağız can Değirmenci
071899d24d tests: delete 'error:' prefix from the tests 2021-05-26 02:45:53 +03:00
Jan Scheer
057ceebdb0 rm: refactor tests for #1982 2021-04-06 00:04:49 +02:00
Marvin Hofmann
9581fcf688
rm: add verbose output and trim multiple slashes (#1988)
* rm: add verbose output and trim multiple slashes

Uses the normalize_path used in cargo to strip duplicate slashes
With a link to a std rfc https://github.com/rust-lang/rfcs/issues/2208

This fixes https://github.com/uutils/coreutils/issues/1829

This also touches https://github.com/uutils/coreutils/issues/1768 
but does not attempt to fully solve it
2021-04-05 22:18:47 +02:00
desbma
be03c948ed
Add pre-commit hook + run fmt (#1959) 2021-03-30 21:24:01 +02:00
Jan Scheer
aac79d13b3
Merge branch 'master' into iss1769 2021-03-25 23:23:08 +01:00
Jan Scheer
61eb4f250d rm: add more tests 2021-03-25 23:04:02 +01:00
Jan Scheer
bdf603a65e rm: make -d/-r obligatory for removing symlink_dir (windows) 2021-03-24 12:42:23 +01:00
Jan Scheer
58b9372dbe rm: fix for -d to match GNU's output #1769 2021-03-18 14:46:56 +01:00
Sylvestre Ledru
1d271991af Rustfmt new tests 2021-03-18 10:24:30 +01:00
Jan Scheer
867e117c99
Update test_rm.rs 2021-03-17 10:20:08 +01:00
Sylvestre Ledru
da362ced71
test(rm): Add a test for multiple -f (#1671) 2020-12-25 14:21:47 +01:00
Sylvestre Ledru
61520546a5 refactor(rm): Move to clap + add a test 2020-11-09 10:27:58 +01:00