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 b84cea4..7c6cef9 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 @@ -99,7 +99,8 @@ fn generate_module_ctors<'n>( let name_for_user = fce_test::utils::new_ident(&name)?; let module_ctor = - quote! { let mut #name_for_user = #module_name::#struct_name { fce: fce.clone() }; }; + quote! { let mut #name_for_user = #module_name::#struct_name::new(fce.clone()); }; + module_ctors.push(module_ctor); } diff --git a/crates/fce-test-macro-impl/src/fce_test/module_generator.rs b/crates/fce-test-macro-impl/src/fce_test/module_generator.rs index 492115a..74318f4 100644 --- a/crates/fce-test-macro-impl/src/fce_test/module_generator.rs +++ b/crates/fce-test-macro-impl/src/fce_test/module_generator.rs @@ -59,7 +59,13 @@ fn generate_module_definition( #module_records pub struct #struct_name_ident { - pub fce: std::rc::Rc>, + fce: std::rc::Rc>, + } + + impl #struct_name_ident { + pub fn new(fce: std::rc::Rc>) -> Self { + Self { fce } + } } impl #struct_name_ident { diff --git a/crates/fce-test-macro-impl/src/fce_test_.rs b/crates/fce-test-macro-impl/src/fce_test_.rs deleted file mode 100644 index fccd95c..0000000 --- a/crates/fce-test-macro-impl/src/fce_test_.rs +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2020 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use crate::attributes::FCETestAttributes; -use crate::TResult; -use crate::TestGeneratorError; - -use fluence_app_service::TomlAppServiceConfig; -use proc_macro2::TokenStream; -use quote::quote; -use quote::ToTokens; - - - -use fce_wit_parser::module_raw_interface; -use fce_wit_parser::interface::FCEModuleInterface; -use fce_wit_parser::interface::FCERecordTypes; -use fce_wit_parser::interface::FCEFunctionSignature; -use fce_wit_parser::interface::it::IFunctionArg; -use fce_wit_parser::interface::it::IRecordFieldType; -use fce_wit_parser::interface::it::IType; - -use std::path::PathBuf; -use syn::parse::Parser; - - - -