File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,14 @@ fn iterator_drops() {
242
242
assert_eq ! ( i. get( ) , 5 ) ;
243
243
}
244
244
245
+ // This test does not work on targets without panic=unwind support.
246
+ // To work around this problem, test is marked is should_panic, so it will
247
+ // be automagically skipped on unsuitable targets, such as
248
+ // wasm32-unknown-unkown.
249
+ //
250
+ // It means that we use panic for indicating success.
245
251
#[ test]
252
+ #[ should_panic( expected = "test succeeded" ) ]
246
253
fn array_default_impl_avoids_leaks_on_panic ( ) {
247
254
use core:: sync:: atomic:: { AtomicUsize , Ordering :: Relaxed } ;
248
255
static COUNTER : AtomicUsize = AtomicUsize :: new ( 0 ) ;
@@ -274,6 +281,7 @@ fn array_default_impl_avoids_leaks_on_panic() {
274
281
assert_eq ! ( * panic_msg, "bomb limit exceeded" ) ;
275
282
// check that all bombs are successfully dropped
276
283
assert_eq ! ( COUNTER . load( Relaxed ) , 0 ) ;
284
+ panic ! ( "test succeeded" )
277
285
}
278
286
279
287
#[ test]
You can’t perform that action at this time.
0 commit comments