From a7db5e282b34fcbe755c54d84a939180367ac1e9 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Tue, 16 Jul 2024 10:04:29 +0200 Subject: [PATCH] chore: add test for option in message descriptors --- prost-reflect-tests/src/json.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/prost-reflect-tests/src/json.rs b/prost-reflect-tests/src/json.rs index 9350ba71..68cdc0c5 100644 --- a/prost-reflect-tests/src/json.rs +++ b/prost-reflect-tests/src/json.rs @@ -13,8 +13,7 @@ use serde_json::json; use crate::{ arbitrary, proto::{ - contains_group, message_with_oneof, ComplexType, ContainsGroup, MessageWithAliasedEnum, - MessageWithOneof, Point, ScalarArrays, Scalars, WellKnownTypes, + contains_group, message_with_oneof, options::Aggregate, ComplexType, ContainsGroup, MessageWithAliasedEnum, MessageWithOneof, Point, ScalarArrays, Scalars, WellKnownTypes }, test_file_descriptor, }; @@ -884,6 +883,19 @@ fn serialize_any_wkt() { ); } +#[test] +fn serialize_options() { + let json = to_json( + Aggregate::default().descriptor().descriptor_proto() + ); + let options = json.get("options").unwrap(); + // Aggregate message descriptor should have some options + assert_ne!( + options.as_object().unwrap().len(), + 0 + ); +} + #[test] fn deserialize_any() { let value: prost_types::Any = from_json(