Skip to content

Commit

Permalink
Run protobuf showcase only with protobuf feature flag enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerkindt committed Jan 20, 2024
1 parent 88a43c8 commit df64c37
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/descriptor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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::<Whatever>()
.expect("Reading from PROTO failed");
let mut reader = writer.as_reader();
let read_value = reader
.read::<Whatever>()
.expect("Reading from PROTO failed");

assert_eq!(value, read_value);
assert_eq!(value, read_value);
}
}
}

0 comments on commit df64c37

Please sign in to comment.