diff --git a/crates/fce-test-macro-impl/src/fce_test/fce_test_impl.rs b/crates/fce-test-macro-impl/src/fce_test/fce_test_impl.rs index 0f5c8c5..fbca688 100644 --- a/crates/fce-test-macro-impl/src/fce_test/fce_test_impl.rs +++ b/crates/fce-test-macro-impl/src/fce_test/fce_test_impl.rs @@ -26,7 +26,7 @@ use std::path::PathBuf; pub fn fce_test_impl( attrs: TokenStream, input: TokenStream, - full_path: PathBuf, + file_path: PathBuf, ) -> TResult { // from https://github.com/dtolnay/syn/issues/788 let parser = syn::punctuated::Punctuated::::parse_terminated; @@ -36,5 +36,5 @@ pub fn fce_test_impl( let func_item = syn::parse2::(input)?; - generate_test_glue_code(func_item, attrs, full_path) + generate_test_glue_code(func_item, attrs, file_path) } diff --git a/crates/fce-test-macro-impl/src/fce_test/glue_code_generator.rs b/crates/fce-test-macro-impl/src/fce_test/glue_code_generator.rs index 244bc5b..9f82780 100644 --- a/crates/fce-test-macro-impl/src/fce_test/glue_code_generator.rs +++ b/crates/fce-test-macro-impl/src/fce_test/glue_code_generator.rs @@ -114,9 +114,9 @@ use std::path::PathBuf; pub(super) fn generate_test_glue_code( func_item: syn::ItemFn, attrs: FCETestAttributes, - full_path: PathBuf, + file_path: PathBuf, ) -> TResult { - let config_path = full_path.join(&attrs.config_path); + let config_path = file_path.join(&attrs.config_path); let fce_config = TomlAppServiceConfig::load(&config_path)?; let modules_dir = match config_utils::resolve_modules_dir(&fce_config, attrs.modules_dir) { @@ -125,7 +125,7 @@ pub(super) fn generate_test_glue_code( }; let app_service_ctor = generate_app_service_ctor(&attrs.config_path, &modules_dir)?; - let modules_dir = full_path.join(modules_dir); + let modules_dir = file_path.join(modules_dir); let module_interfaces = fce_test::config_utils::collect_modules(&fce_config, modules_dir)?; let module_definitions = diff --git a/crates/fce-test-macro/src/lib.rs b/crates/fce-test-macro/src/lib.rs index f562c17..90aa8e0 100644 --- a/crates/fce-test-macro/src/lib.rs +++ b/crates/fce-test-macro/src/lib.rs @@ -46,10 +46,11 @@ use syn::spanned::Spanned; pub fn fce_test(attrs: TokenStream, input: TokenStream) -> TokenStream { let attrs: proc_macro2::TokenStream = attrs.into(); let attrs_span = attrs.span(); - let mut full_path = proc_macro::Span::call_site().source_file().path(); - let _ = full_path.pop(); + // here it obtains a path to the current file where macro is applied + let mut file_path = proc_macro::Span::call_site().source_file().path(); + let _ = file_path.pop(); - match fce_test_impl(attrs, input.into(), full_path) { + match fce_test_impl(attrs, input.into(), file_path) { Ok(stream) => stream.into(), Err(e) => proc_macro_error::abort!(attrs_span, format!("{}", e)), }