Skip to content

Commit

Permalink
add simple config test
Browse files Browse the repository at this point in the history
  • Loading branch information
pront committed Dec 7, 2023
1 parent 7eac7f0 commit f8cc865
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/codecs/src/encoding/format/protobuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f8cc865

Please sign in to comment.