find: Implement -amin -cmin -mmin age ranges.#355
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
==========================================
+ Coverage 58.83% 59.12% +0.28%
==========================================
Files 30 30
Lines 3855 3914 +59
Branches 846 863 +17
==========================================
+ Hits 2268 2314 +46
- Misses 1254 1259 +5
- Partials 333 341 +8 ☔ View full report in Codecov by Sentry. |
| File::create(temp_dir.path().join(new_file_name)).expect("create temp file"); | ||
| let new_file = get_dir_entry_for(&temp_dir_path, new_file_name); | ||
|
|
||
| // mores test |
There was a problem hiding this comment.
| // mores test | |
| // more test |
There was a problem hiding this comment.
Thanks. Changed in new commit.
|
please add integrations tests in https://github.com/uutils/findutils/blob/main/tests/find_cmd_tests.rs |
I've added tests for string type numbers. This has to do with the way the Should I fix them in a new PR? $ find . -atime 1%2
find: invalid argument `1%2' to `-atime'
$ find . -amin 1%2
find: invalid argument `1%2' to `-amin'
$ ./target/debug/find . -atime 1%2
$ ./target/debug/find . -amin 1%2
./.git
./.git/objects/b1
./.git/objects/7f
./.git/objects/a8
./target/debug/deps
./target/debug/incremental/find_cmd_tests-8yeq2sf4g2ts
... |
| "\"-60\"", "\"-120\"", "\"-240\"", "\"-60\"", "\"-120\"", "\"-240\"", | ||
| ]; | ||
|
|
||
| for (arg, time) in args.iter().zip(times.iter()) { |
There was a problem hiding this comment.
I think this piece of code doesn't do what you think it does ;-) It doesn't create the Cartesian product of args and times:
for (arg, time) in args.iter().zip(times.iter()) {
println!("{arg}: {time}");
}outputs:
-amin: -60
-cmin: -120
-mmin: -240
There was a problem hiding this comment.
Agree. I replaced it with a nested loop. : )
| .code(0); | ||
| } | ||
|
|
||
| for (arg, time_string) in args.iter().zip(time_strings.iter()) { |
There was a problem hiding this comment.
See my previous comment.
| for arg in args.iter() { | ||
| for time in times.iter() { |
There was a problem hiding this comment.
Calling iter() is not necessary here.
| for arg in args.iter() { | |
| for time in times.iter() { | |
| for arg in args { | |
| for time in times { |
| for arg in args.iter() { | ||
| for time_string in time_strings.iter() { |
There was a problem hiding this comment.
| for arg in args.iter() { | |
| for time_string in time_strings.iter() { | |
| for arg in args { | |
| for time_string in time_strings { |
| for arg in args.iter() { | ||
| for time_string in time_strings.iter() { | ||
| Command::cargo_bin("find") | ||
| .expect("the except time should not match") |
There was a problem hiding this comment.
I'm not sure about this one:
| .expect("the except time should not match") | |
| .expect("the time should not match") |
| let args = ["-amin", "-cmin", "-mmin"]; | ||
| let times = ["-60", "-120", "-240", "+60", "+120", "+240"]; | ||
|
|
||
| for (arg, time) in args.iter().zip(times.iter()) { |
There was a problem hiding this comment.
Here you need a nested loop to get the expected result because zip doesn't generate the Cartesian product of args and times.
|
Thanks, the conflict has been resolved and the code modified in new commits. |
|
it would be nice to work on #360 next |
Thanks! I will complete it as soon as I can. |
implement: #221