diff options
Diffstat (limited to 'examples/10-transient-0/output/rust/src/lib.rs')
| -rw-r--r-- | examples/10-transient-0/output/rust/src/lib.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/examples/10-transient-0/output/rust/src/lib.rs b/examples/10-transient-0/output/rust/src/lib.rs index 9b53c0e..6468674 100644 --- a/examples/10-transient-0/output/rust/src/lib.rs +++ b/examples/10-transient-0/output/rust/src/lib.rs @@ -4,8 +4,7 @@ pub mod transient_0; #[cfg(test)] mod test { use std::io::Cursor; - use super::data::StructWithInt32; - use super::data::StructWithInt64; + use super::data::{InnerStruct, OuterStruct, StructWithInt32, StructWithInt64}; #[test] fn struct_with_int_32() { @@ -29,6 +28,17 @@ mod test { ); } + #[test] + fn nested_struct() { + let value = OuterStruct { inner: InnerStruct { a: 10, b: 25 }, c: 42 }; + + assert_round_trip_encoding( + value, + super::data::transient_0::encode_outer_struct, + super::data::transient_0::decode_outer_struct, + ); + } + fn assert_round_trip_encoding<T: std::cmp::PartialEq + std::fmt::Debug>( value: T, encode: impl Fn(&T, &mut Cursor<Vec<u8>>), |
