From c522181292a58b51a3fc41f21c7bb6b5c401ebd6 Mon Sep 17 00:00:00 2001 From: Aleks Zi <137826094+ziaptos@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:53:27 -0500 Subject: [PATCH] followup to a TODO for a constant --- api/types/src/move_types.rs | 69 +++++++++++++++---------------------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/api/types/src/move_types.rs b/api/types/src/move_types.rs index c6a3d4942ad86..3b0efb62b9bd6 100644 --- a/api/types/src/move_types.rs +++ b/api/types/src/move_types.rs @@ -1260,40 +1260,30 @@ mod tests { fn test_serialize_move_resource() { use AnnotatedMoveValue::*; - let res = MoveResource::try_from(annotated_move_struct( - "Values", - vec![ - (identifier("field_u8"), U8(7)), - (identifier("field_u64"), U64(7)), - (identifier("field_u128"), U128(7)), - (identifier("field_bool"), Bool(true)), - (identifier("field_address"), Address(address("0xdd"))), - ( - identifier("field_vector"), - Vector(TypeTag::U128, vec![U128(128)]), - ), - (identifier("field_bytes"), Bytes(vec![9, 9])), - ( - identifier("field_struct"), - Struct(annotated_move_struct( - "Nested", - vec![( - identifier("nested_vector"), - Vector( - TypeTag::Struct(Box::new(type_struct("Host"))), - vec![Struct(annotated_move_struct( - "String", - vec![ - (identifier("address1"), Address(address("0x0"))), - (identifier("address2"), Address(address("0x123"))), - ], - ))], - ), - )], - )), - ), - ], - )) + let res = MoveResource::try_from(annotated_move_struct("Values", vec![ + (identifier("field_u8"), U8(7)), + (identifier("field_u64"), U64(7)), + (identifier("field_u128"), U128(7)), + (identifier("field_bool"), Bool(true)), + (identifier("field_address"), Address(address("0xdd"))), + ( + identifier("field_vector"), + Vector(TypeTag::U128, vec![U128(128)]), + ), + (identifier("field_bytes"), Bytes(vec![9, 9])), + ( + identifier("field_struct"), + Struct(annotated_move_struct("Nested", vec![( + identifier("nested_vector"), + Vector(TypeTag::Struct(Box::new(type_struct("Host"))), vec![ + Struct(annotated_move_struct("String", vec![ + (identifier("address1"), Address(address("0x0"))), + (identifier("address2"), Address(address("0x123"))), + ])), + ]), + )])), + ), + ])) .unwrap(); let value = to_value(&res).unwrap(); assert_json( @@ -1318,13 +1308,10 @@ mod tests { #[test] fn test_serialize_move_resource_with_address_0x0() { - let res = MoveResource::try_from(annotated_move_struct( - "Values", - vec![( - identifier("address_0x0"), - AnnotatedMoveValue::Address(address("0x0")), - )], - )) + let res = MoveResource::try_from(annotated_move_struct("Values", vec![( + identifier("address_0x0"), + AnnotatedMoveValue::Address(address("0x0")), + )])) .unwrap(); let value = to_value(&res).unwrap(); assert_json(