uutils / findutils

Rust implementation of findutils
MIT License
300 stars 37 forks source link

find: Implement `-amin` `-cmin` `-mmin` age ranges. #355

Closed hanbings closed 4 months ago

hanbings commented 5 months ago

implement: https://github.com/uutils/findutils/issues/221

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 77.96610% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 59.12%. Comparing base (add14db) to head (6579285).

Files Patch % Lines
src/find/matchers/time.rs 73.07% 3 Missing and 4 partials :warning:
src/find/matchers/mod.rs 50.00% 2 Missing and 4 partials :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sylvestre commented 5 months ago

please add integrations tests in https://github.com/uutils/findutils/blob/main/tests/find_cmd_tests.rs and please tests with invalid values (like string for numerical values)

hanbings commented 5 months ago

please add integrations tests in https://github.com/uutils/findutils/blob/main/tests/find_cmd_tests.rs and please tests with invalid values (like string for numerical values)

I've added tests for string type numbers. But I found that it is able to recognize error parameters such as 1%2 and +-321, which is different from the GNU find results.

This has to do with the way the convert_arg_to_comparable_value function recognizes and converts numbers, meaning that this problem occurs with both the a/c/mtime and a/c/mmin arguments.

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
...
hanbings commented 4 months ago

Thanks, the conflict has been resolved and the code modified in new commits.

sylvestre commented 4 months ago

it would be nice to work on https://github.com/uutils/findutils/issues/360 next it will be easier to detect improvement / regression wrt the GNU test suite

hanbings commented 4 months ago

it would be nice to work on #360 next it will be easier to detect improvement / regression wrt the GNU test suite

Thanks! I will complete it as soon as I can.