File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,30 @@ fn serde_instruction_coption_pubkey_with_none() {
4040 serde_json:: from_str :: < instruction:: TokenInstruction > ( & serialized) . unwrap ( ) ;
4141}
4242
43+ #[ test]
44+ fn serde_instruction_coption_u64 ( ) {
45+ let inst = instruction:: TokenInstruction :: UnwrapLamports {
46+ amount : COption :: Some ( 1 ) ,
47+ } ;
48+
49+ let serialized = serde_json:: to_string ( & inst) . unwrap ( ) ;
50+ assert_eq ! ( & serialized, "{\" unwrapLamports\" :{\" amount\" :\" 1\" }}" ) ;
51+
52+ serde_json:: from_str :: < instruction:: TokenInstruction > ( & serialized) . unwrap ( ) ;
53+ }
54+
55+ #[ test]
56+ fn serde_instruction_coption_u64_with_none ( ) {
57+ let inst = instruction:: TokenInstruction :: UnwrapLamports {
58+ amount : COption :: None ,
59+ } ;
60+
61+ let serialized = serde_json:: to_string ( & inst) . unwrap ( ) ;
62+ assert_eq ! ( & serialized, "{\" unwrapLamports\" :{\" amount\" :null}}" ) ;
63+
64+ serde_json:: from_str :: < instruction:: TokenInstruction > ( & serialized) . unwrap ( ) ;
65+ }
66+
4367#[ test]
4468fn serde_instruction_optional_nonzero_pubkeys_podbool ( ) {
4569 // tests serde of ix containing OptionalNonZeroPubkey, PodBool and
You can’t perform that action at this time.
0 commit comments