File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -475,6 +475,18 @@ impl PartialEq<std::vec::Vec<xdr::ContractEvent>> for ContractEvents {
475475 }
476476}
477477
478+ impl PartialEq < & [ xdr:: ContractEvent ] > for ContractEvents {
479+ fn eq ( & self , other : & & [ xdr:: ContractEvent ] ) -> bool {
480+ self . events == * other
481+ }
482+ }
483+
484+ impl < const N : usize > PartialEq < [ xdr:: ContractEvent ; N ] > for ContractEvents {
485+ fn eq ( & self , other : & [ xdr:: ContractEvent ; N ] ) -> bool {
486+ self . events == other
487+ }
488+ }
489+
478490impl PartialEq < Vec < ( crate :: Address , Vec < Val > , Val ) > > for ContractEvents {
479491 fn eq ( & self , other : & Vec < ( crate :: Address , Vec < Val > , Val ) > ) -> bool {
480492 let len = match u32:: try_from ( self . events . len ( ) ) {
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ impl Contract {
4141#[ cfg( test) ]
4242mod test {
4343 extern crate alloc;
44- extern crate std;
4544
4645 use soroban_sdk:: {
4746 map, symbol_short,
@@ -65,13 +64,13 @@ mod test {
6564
6665 assert_eq ! (
6766 env. events( ) . all( ) ,
68- std :: vec! [ Transfer {
67+ [ Transfer {
6968 from: & from,
7069 to: & to. address( ) ,
7170 amount: & amount,
7271 to_muxed_id: Some ( & to. id( ) . unwrap( ) ) ,
7372 }
74- . to_xdr( & env, & contract_id) , ] ,
73+ . to_xdr( & env, & contract_id) ] ,
7574 ) ;
7675
7776 // duplicate check to assert previous event testing pattern works
@@ -115,13 +114,13 @@ mod test {
115114
116115 assert_eq ! (
117116 env. events( ) . all( ) ,
118- std :: vec! [ Transfer {
117+ [ Transfer {
119118 from: & from,
120119 to: & to,
121120 amount: & amount,
122121 to_muxed_id: None ,
123122 }
124- . to_xdr( & env, & contract_id) , ] ,
123+ . to_xdr( & env, & contract_id) ] ,
125124 ) ;
126125
127126 // duplicate check to assert previous event testing pattern works
@@ -156,6 +155,6 @@ mod test {
156155 let from = Address :: generate ( & env) ;
157156 let to = Address :: generate ( & env) ;
158157 let _ = client. try_failed_transfer ( & from, & to, & 1 ) ;
159- assert_eq ! ( env. events( ) . all( ) , std :: vec! [ ] ) ;
158+ assert_eq ! ( env. events( ) . all( ) , [ ] ) ;
160159 }
161160}
You can’t perform that action at this time.
0 commit comments