Skip to content

Commit d33ea7b

Browse files
committed
cleanup FromTVMStack optional test
1 parent afb8b3a commit d33ea7b

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

ton/src/block_tlb/tvm_types/from_tvm_stack.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,27 +216,21 @@ mod tests {
216216

217217
#[test]
218218
fn test_from_tvm_stack_optional() -> anyhow::Result<()> {
219-
let mut stack_with_value = TVMStack::default();
220-
stack_with_value.push_tiny_int(111);
221-
stack_with_value.push_tiny_int(222);
222-
223-
let mut stack_none = TVMStack::default();
224-
stack_none.push(TVMNull.into());
225-
stack_none.push_tiny_int(222);
226-
219+
let mut stack = TVMStack::default();
220+
stack.push_tiny_int(11);
221+
stack.push(TVMNull.into());
222+
stack.push_tiny_int(33);
227223
#[derive(FromTVMStack, Debug)]
228224
struct TestStruct {
229-
pub value: Option<u8>,
225+
pub opt_some: Option<u8>,
226+
pub opt_none: Option<u8>,
230227
pub another_field: u8,
231228
}
232229

233-
let parsed_some = TestStruct::from_stack(&mut stack_with_value)?;
234-
assert_eq!(parsed_some.value, Some(111));
235-
assert_eq!(parsed_some.another_field, 222);
236-
237-
let parsed_none = TestStruct::from_stack(&mut stack_none)?;
238-
assert_eq!(parsed_none.value, None);
239-
assert_eq!(parsed_none.another_field, 222);
230+
let parsed = TestStruct::from_stack(&mut stack)?;
231+
assert_eq!(parsed.opt_some, Some(11));
232+
assert_eq!(parsed.opt_none, None);
233+
assert_eq!(parsed.another_field, 33);
240234
Ok(())
241235
}
242236
}

0 commit comments

Comments
 (0)