From df64c370f0e2e5d21dc4021366026cf71076bf06 Mon Sep 17 00:00:00 2001 From: Michael Watzko Date: Sat, 20 Jan 2024 14:01:24 +0100 Subject: [PATCH] Run protobuf showcase only with protobuf feature flag enabled --- src/descriptor/mod.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/descriptor/mod.rs b/src/descriptor/mod.rs index 2507724..8d93fd1 100644 --- a/src/descriptor/mod.rs +++ b/src/descriptor/mod.rs @@ -243,8 +243,7 @@ mod tests { use crate::descriptor::common; use crate::descriptor::sequence::Sequence; use crate::descriptor::utf8string::Utf8String; - use crate::prelude::{ProtobufWriter, UperWriter}; - use crate::rw::PrintlnWriter; + use crate::prelude::*; use asn1rs_model::asn::Tag; #[test] @@ -332,14 +331,17 @@ mod tests { // // Showcase: Protobuf // - let mut writer = ProtobufWriter::default(); - writer.write(&value).expect("Writing to PROTO failed"); + #[cfg(feature = "protobuf")] + { + let mut writer = ProtobufWriter::default(); + writer.write(&value).expect("Writing to PROTO failed"); - let mut reader = writer.as_reader(); - let read_value = reader - .read::() - .expect("Reading from PROTO failed"); + let mut reader = writer.as_reader(); + let read_value = reader + .read::() + .expect("Reading from PROTO failed"); - assert_eq!(value, read_value); + assert_eq!(value, read_value); + } } }