summaryrefslogtreecommitdiff
path: root/examples/10-transient-0/output/rust/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/10-transient-0/output/rust/src/lib.rs')
-rw-r--r--examples/10-transient-0/output/rust/src/lib.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/examples/10-transient-0/output/rust/src/lib.rs b/examples/10-transient-0/output/rust/src/lib.rs
index 6ecb19e..a06f73e 100644
--- a/examples/10-transient-0/output/rust/src/lib.rs
+++ b/examples/10-transient-0/output/rust/src/lib.rs
@@ -4,7 +4,7 @@ pub mod transient_0;
#[cfg(test)]
mod test {
use std::io::Cursor;
- use super::data::{InnerStruct, OuterStruct, StructWithBool, StructWithInt32, StructWithInt64, StructWithString};
+ use super::data::{InnerStruct, OuterStruct, StructWithBool, StructWithInt32, StructWithInt64, StructWithList, StructWithString};
#[test]
fn struct_with_bool() {
@@ -61,6 +61,24 @@ mod test {
);
}
+ #[test]
+ fn struct_with_list() {
+ let value = StructWithList {
+ a: vec![10, 25],
+ b: vec![
+ InnerStruct { a: 42, b: 47 },
+ InnerStruct { a: 52, b: 57 },
+ InnerStruct { a: 62, b: 67 },
+ ],
+ };
+
+ assert_round_trip_encoding(
+ value,
+ super::data::transient_0::encode_struct_with_list,
+ super::data::transient_0::decode_struct_with_list,
+ );
+ }
+
fn assert_round_trip_encoding<T: std::cmp::PartialEq + std::fmt::Debug>(
value: T,
encode: impl Fn(&T, &mut Cursor<Vec<u8>>) -> std::io::Result<()>,