-
Notifications
You must be signed in to change notification settings - Fork 41
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
find: Implement -amin
-cmin
-mmin
age ranges.
#355
Changes from 10 commits
c60b060
7180e7d
297c250
54dea2a
ff60a23
1b48456
aa8f348
08dc112
1847f3d
90d09c9
1c48744
5f1fd39
981b449
6579285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -518,3 +518,38 @@ fn expression_empty_parentheses() { | |||||||||
)) | ||||||||||
.stdout(predicate::str::is_empty()); | ||||||||||
} | ||||||||||
|
||||||||||
#[test] | ||||||||||
fn find_age_range() { | ||||||||||
let args = ["-amin", "-cmin", "-mmin"]; | ||||||||||
let times = ["-60", "-120", "-240", "+60", "+120", "+240"]; | ||||||||||
let time_strings = [ | ||||||||||
"\"-60\"", "\"-120\"", "\"-240\"", "\"-60\"", "\"-120\"", "\"-240\"", | ||||||||||
]; | ||||||||||
|
||||||||||
for arg in args.iter() { | ||||||||||
for time in times.iter() { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calling
Suggested change
|
||||||||||
Command::cargo_bin("find") | ||||||||||
.expect("the time should match") | ||||||||||
.args(["test_data/simple", arg, time]) | ||||||||||
.assert() | ||||||||||
.success() | ||||||||||
.code(0); | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
for arg in args.iter() { | ||||||||||
for time_string in time_strings.iter() { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
Command::cargo_bin("find") | ||||||||||
.expect("the except time should not match") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about this one:
Suggested change
|
||||||||||
.args(["test_data/simple", arg, time_string]) | ||||||||||
.assert() | ||||||||||
.failure() | ||||||||||
.code(1) | ||||||||||
.stderr(predicate::str::contains( | ||||||||||
"Error: Expected a decimal integer (with optional + or - prefix) argument to", | ||||||||||
)) | ||||||||||
.stdout(predicate::str::is_empty()); | ||||||||||
} | ||||||||||
} | ||||||||||
} |
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.
Here you need a nested loop to get the expected result because
zip
doesn't generate the Cartesian product ofargs
andtimes
.