@@ -191,7 +191,7 @@ pub struct Expectations {
191
191
pub expect_validate_caller_type : Option < Vec < Type > > ,
192
192
pub expect_sends : VecDeque < ExpectedMessage > ,
193
193
pub expect_create_actor : Option < ExpectCreateActor > ,
194
- pub expect_delete_actor : Option < Address > ,
194
+ pub expect_delete_actor : bool ,
195
195
pub expect_verify_sigs : VecDeque < ExpectedVerifySig > ,
196
196
pub expect_verify_post : Option < ExpectVerifyPoSt > ,
197
197
pub expect_compute_unsealed_sector_cid : VecDeque < ExpectComputeUnsealedSectorCid > ,
@@ -245,11 +245,7 @@ impl Expectations {
245
245
"expected actor to be created, uncreated actor: {:?}" ,
246
246
this. expect_create_actor
247
247
) ;
248
- assert ! (
249
- this. expect_delete_actor. is_none( ) ,
250
- "expected actor to be deleted: {:?}" ,
251
- this. expect_delete_actor
252
- ) ;
248
+ assert ! ( !this. expect_delete_actor, "expected actor to be deleted" , ) ;
253
249
assert ! (
254
250
this. expect_verify_sigs. is_empty( ) ,
255
251
"expect_verify_sigs: {:?}, not received" ,
@@ -624,8 +620,8 @@ impl<BS: Blockstore> MockRuntime<BS> {
624
620
}
625
621
626
622
#[ allow( dead_code) ]
627
- pub fn expect_delete_actor ( & self , beneficiary : Address ) {
628
- self . expectations . borrow_mut ( ) . expect_delete_actor = Some ( beneficiary ) ;
623
+ pub fn expect_delete_actor ( & self ) {
624
+ self . expectations . borrow_mut ( ) . expect_delete_actor = true ;
629
625
}
630
626
631
627
#[ allow( dead_code) ]
@@ -1185,18 +1181,14 @@ impl<BS: Blockstore> Runtime for MockRuntime<BS> {
1185
1181
Ok ( ( ) )
1186
1182
}
1187
1183
1188
- fn delete_actor ( & self , addr : & Address ) -> Result < ( ) , ActorError > {
1184
+ fn delete_actor ( & self ) -> Result < ( ) , ActorError > {
1189
1185
self . require_in_call ( ) ;
1190
1186
if * self . in_transaction . borrow ( ) {
1191
1187
return Err ( actor_error ! ( assertion_failed; "side-effect within transaction" ) ) ;
1192
1188
}
1193
- let exp_act = self . expectations . borrow_mut ( ) . expect_delete_actor . take ( ) ;
1194
- if exp_act. is_none ( ) {
1195
- panic ! ( "unexpected call to delete actor: {}" , addr) ;
1196
- }
1197
- if exp_act. as_ref ( ) . unwrap ( ) != addr {
1198
- panic ! ( "attempt to delete wrong actor. Expected: {}, got: {}" , exp_act. unwrap( ) , addr) ;
1199
- }
1189
+ let mut exp = self . expectations . borrow_mut ( ) ;
1190
+ assert ! ( exp. expect_delete_actor, "unexpected call to delete actor" ) ;
1191
+ exp. expect_delete_actor = false ;
1200
1192
Ok ( ( ) )
1201
1193
}
1202
1194
0 commit comments