Skip to content

Commit

Permalink
✅ [macros] validate generated test now decorated with #[cfg(test)]
Browse files Browse the repository at this point in the history
Thus will no longer end up in release builds.
  • Loading branch information
luukvanderduim committed Mar 5, 2024
1 parent c265453 commit 9fe9aa0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zbus-lockstep-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,19 @@ pub fn validate(args: TokenStream, input: TokenStream) -> TokenStream {
let item_plus_validation_test = quote! {
#item_struct

#[cfg(test)]
#[test]
fn #test_name() {
use zvariant::{self, Type};
let xml_file = std::fs::File::open(#xml_file_path).expect(#xml_file_path);
use zvariant::Type;

let xml_file = std::fs::File::open(#xml_file_path).expect("\"#xml_file_path\" expected to be a valid file path." );
let item_signature_from_xml = zbus_lockstep::get_signal_body_type(
xml_file,
#interface_name,
#signal_name,
None
).expect("Failed to get signal body type from XML file");

let item_signature_from_struct = <#item_struct_name as zvariant::Type>::signature();
).expect("Failed to get signal body type from XML file.");
let item_signature_from_struct = <#item_struct_name as Type>::signature();

assert_eq!(&item_signature_from_xml, &item_signature_from_struct);
}
Expand Down

0 comments on commit 9fe9aa0

Please sign in to comment.