From f8cc8656d0ee5001a7311951071a4283c440b0bd Mon Sep 17 00:00:00 2001 From: Pavlos Rontidis Date: Thu, 30 Nov 2023 18:49:28 +0200 Subject: [PATCH] add simple config test --- lib/codecs/src/encoding/format/protobuf.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/codecs/src/encoding/format/protobuf.rs b/lib/codecs/src/encoding/format/protobuf.rs index 7cc4a6e8622a0..174bf3727e624 100644 --- a/lib/codecs/src/encoding/format/protobuf.rs +++ b/lib/codecs/src/encoding/format/protobuf.rs @@ -234,12 +234,27 @@ mod tests { }; } + fn test_data_dir() -> PathBuf { + PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("tests/data/protobuf") + } + fn test_message_descriptor(message_type: &str) -> MessageDescriptor { let path = PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap()) .join("tests/data/protobuf/protos/test.desc"); get_message_descriptor(&path, &format!("test.{message_type}")).unwrap() } + #[test] + fn test_config_input_type() { + let config = ProtobufSerializerConfig { + protobuf: ProtobufSerializerOptions { + desc_file: test_data_dir().join("test_protobuf.desc"), + message_type: "test_protobuf.Person".into(), + }, + }; + assert_eq!(config.input_type(), DataType::all()); + } + #[test] fn test_encode_integers() { let message = encode_message(