Skip to content

Commit 42a00c1

Browse files
committed
add unit test
1 parent 79480cc commit 42a00c1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/testsuite/clippy.rs

+34
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,37 @@ fn clippy_force_rebuild() {
3838
.with_stderr_contains("[..]assert!(true)[..]")
3939
.run();
4040
}
41+
42+
#[cargo_test]
43+
fn clippy_passes_args() {
44+
if !clippy_is_available() {
45+
return;
46+
}
47+
48+
// This is just a random clippy lint (assertions_on_constants) that
49+
// hopefully won't change much in the future.
50+
let p = project()
51+
.file(
52+
"Cargo.toml",
53+
r#"
54+
[package]
55+
name = "foo"
56+
version = "0.1.0"
57+
58+
[dependencies]
59+
"#,
60+
)
61+
.file("src/lib.rs", "pub fn f() { assert!(true); }")
62+
.build();
63+
64+
p.cargo("clippy-preview -Zunstable-options -v -- -Aclippy::assertions_on_constants")
65+
.masquerade_as_nightly_cargo()
66+
.with_stderr_does_not_contain("[..]assert!(true)[..]")
67+
.run();
68+
69+
// Make sure it runs again.
70+
p.cargo("clippy-preview -Zunstable-options -v")
71+
.masquerade_as_nightly_cargo()
72+
.with_stderr_contains("[..]assert!(true)[..]")
73+
.run();
74+
}

0 commit comments

Comments
 (0)