Skip to content
Snippets Groups Projects
Verified Commit c15f6d3f authored by Vincent Lafeychine's avatar Vincent Lafeychine
Browse files

clippy: Fix tests_outside_test_module

parent 673e707e
No related branches found
No related tags found
1 merge request!47Fix most of `clippy::restriction` and `clippy::pedantic`
......@@ -34,7 +34,6 @@ rustflags = [
# clippy::restriction
"-Aclippy::non_ascii_literal",
"-Aclippy::panic_in_result_fn",
"-Aclippy::tests_outside_test_module",
"-Aclippy::unneeded_field_pattern",
"-Aclippy::unwrap_in_result",
......
......@@ -30,16 +30,21 @@ pub fn arg_value<'a, T: Deref<Target = str>, F: Fn(&str) -> bool>(
None
}
#[test]
fn test_arg_value() {
let args = &["--bar=bar", "--foobar", "123", "--foo"];
#[cfg(test)]
mod tests {
use super::*;
assert_eq!(arg_value(&[] as &[&str], "--foobar", |_| true), None);
assert_eq!(arg_value(args, "--bar", |_| false), None);
assert_eq!(arg_value(args, "--bar", |_| true), Some("bar"));
assert_eq!(arg_value(args, "--bar", |p| p == "bar"), Some("bar"));
assert_eq!(arg_value(args, "--bar", |p| p == "foo"), None);
assert_eq!(arg_value(args, "--foobar", |p| p == "foo"), None);
assert_eq!(arg_value(args, "--foobar", |p| p == "123"), Some("123"));
assert_eq!(arg_value(args, "--foo", |_| true), None);
#[test]
fn test_arg_value() {
let args = &["--bar=bar", "--foobar", "123", "--foo"];
assert_eq!(arg_value(&[] as &[&str], "--foobar", |_| true), None);
assert_eq!(arg_value(args, "--bar", |_| false), None);
assert_eq!(arg_value(args, "--bar", |_| true), Some("bar"));
assert_eq!(arg_value(args, "--bar", |p| p == "bar"), Some("bar"));
assert_eq!(arg_value(args, "--bar", |p| p == "foo"), None);
assert_eq!(arg_value(args, "--foobar", |p| p == "foo"), None);
assert_eq!(arg_value(args, "--foobar", |p| p == "123"), Some("123"));
assert_eq!(arg_value(args, "--foo", |_| true), None);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment