Skip to content

Commit

Permalink
Add config_proc_macro to system tests
Browse files Browse the repository at this point in the history
Also formats unforamatted files in the crate.
  • Loading branch information
ytmimi committed Jun 13, 2024
1 parent 8abbcad commit 30eb54b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion config_proc_macro/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ fn get_name_value_str_lit(attr: &syn::Attribute, name: &str) -> Option<String> {
match &attr.meta {
syn::Meta::NameValue(syn::MetaNameValue {
path,
value: syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit_str), .. }),
value:
syn::Expr::Lit(syn::ExprLit {
lit: syn::Lit::Str(lit_str),
..
}),
..
}) if path.is_ident(name) => Some(lit_str.value()),
_ => None,
Expand Down
18 changes: 15 additions & 3 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,24 @@ fn self_tests() {
files.push(path);
}
// for crates that need to be included but lies outside src
let external_crates = vec!["check_diff"];
let external_crates = vec!["check_diff", "config_proc_macro"];
for external_crate in external_crates {
let mut path = PathBuf::from(external_crate);
path.push("src");
path.push("main.rs");
files.push(path);
let directory = fs::read_dir(&path).unwrap();
let search_files = directory.filter_map(|file| {
file.ok().and_then(|f| {
let name = f.file_name();
if matches!(name.as_os_str().to_str(), Some("main.rs" | "lib.rs")) {
Some(f.path())
} else {
None
}
})
});
for file in search_files {
files.push(file);
}
}
files.push(PathBuf::from("src/lib.rs"));

Expand Down

0 comments on commit 30eb54b

Please sign in to comment.