summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/workspace.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/workspace.rs')
-rw-r--r--src/tools/clippy/tests/workspace.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/workspace.rs b/src/tools/clippy/tests/workspace.rs
index c9cbc5054..699ab2be1 100644
--- a/src/tools/clippy/tests/workspace.rs
+++ b/src/tools/clippy/tests/workspace.rs
@@ -7,6 +7,46 @@ use test_utils::{CARGO_CLIPPY_PATH, IS_RUSTC_TEST_SUITE};
mod test_utils;
#[test]
+fn test_module_style_with_dep_in_subdir() {
+ if IS_RUSTC_TEST_SUITE {
+ return;
+ }
+ let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+ let target_dir = root.join("target").join("workspace_test");
+ let cwd = root.join("tests/workspace_test");
+
+ // Make sure we start with a clean state
+ Command::new("cargo")
+ .current_dir(&cwd)
+ .env("CARGO_TARGET_DIR", &target_dir)
+ .arg("clean")
+ .args(["-p", "pass-no-mod-with-dep-in-subdir"])
+ .args(["-p", "pass-mod-with-dep-in-subdir"])
+ .output()
+ .unwrap();
+
+ // [#8887](https://github.com/rust-lang/rust-clippy/issues/8887)
+ // `mod.rs` checks should not be applied to crate dependencies
+ // located in the subdirectory of workspace
+ let output = Command::new(&*CARGO_CLIPPY_PATH)
+ .current_dir(&cwd)
+ .env("CARGO_INCREMENTAL", "0")
+ .env("CARGO_TARGET_DIR", &target_dir)
+ .arg("clippy")
+ .args(["-p", "pass-no-mod-with-dep-in-subdir"])
+ .args(["-p", "pass-mod-with-dep-in-subdir"])
+ .arg("--")
+ .arg("-Cdebuginfo=0") // disable debuginfo to generate less data in the target dir
+ .output()
+ .unwrap();
+
+ println!("status: {}", output.status);
+ println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
+ println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
+ assert!(output.status.success());
+}
+
+#[test]
fn test_no_deps_ignores_path_deps_in_workspaces() {
if IS_RUSTC_TEST_SUITE {
return;