-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix touch parse date error #2317
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just some minor changes
src/uu/touch/src/touch.rs
Outdated
Err(e) => panic!("Unable to parse date\n{}", e), | ||
let formats = vec!["%c", "%F"]; | ||
for f in formats { | ||
match time::strptime(str, f) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please fix the clippy warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/uu/touch/src/touch.rs
Outdated
} | ||
panic!("Unable to parse date\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a test to trigger this error (and probably use show_error instead of a panic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test added and use show_error
.
Now it can parse `touch -d 2000-01-23 file` and add test for parse date error. Related to uutils#2311
9b2ef7a
to
9d8e7b9
Compare
Increased the number of gnu tests by 2, well done :) |
Now it can parse
touch -d 2000-01-23 file
Related to #2311