diff --git a/Cargo.lock b/Cargo.lock index d775dc35d..92892c5b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -863,6 +863,7 @@ dependencies = [ "cargo_metadata", "dylint_internal", "toml_edit 0.19.8", + "walkdir", ] [[package]] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index fa3345e7d..136e67a38 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -9,5 +9,6 @@ publish = false [dev-dependencies] cargo_metadata = "0.15" toml_edit = "0.19" +walkdir = "2.3" dylint_internal = { version = "=2.1.7", path = "../internal", features = ["clippy_utils", "examples"] } diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 95e9f3025..8dc741491 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -6,6 +6,7 @@ mod test { }; use std::{ffi::OsStr, fs::read_to_string}; use toml_edit::{Document, Item, Value}; + use walkdir::WalkDir; #[test] fn examples() { @@ -95,4 +96,17 @@ mod test { assert!(!components.contains(&"rust-src")); } } + + #[test] + fn examples_do_not_have_gitignore() { + for entry in WalkDir::new(".") { + let entry = entry.unwrap(); + let path = entry.path(); + assert_ne!( + path.file_name(), + Some(OsStr::new(".gitignore")), + "failed for {path:?}" + ); + } + } }