about summary refs log tree commit diff
path: root/src/libcore/tests/array.rs
diff options
context:
space:
mode:
authorMikail Bagishov <bagishov.mikail@yandex.ru>2020-05-28 20:45:21 +0300
committerMikail Bagishov <bagishov.mikail@yandex.ru>2020-05-28 20:45:21 +0300
commit3313bf62ac45fab2c39e49c788423153754087a9 (patch)
treebdd73f6d664ca2cef0e583cb4c09427beb98ff57 /src/libcore/tests/array.rs
parent591584e71f7d8a613d586066c8b01c1eecf08f35 (diff)
downloadrust-3313bf62ac45fab2c39e49c788423153754087a9.tar.gz
rust-3313bf62ac45fab2c39e49c788423153754087a9.zip
Skip leak test on targets without panic=unwind
Diffstat (limited to 'src/libcore/tests/array.rs')
-rw-r--r--src/libcore/tests/array.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/tests/array.rs b/src/libcore/tests/array.rs
index 41855a9a8cb..4bc44e98fc8 100644
--- a/src/libcore/tests/array.rs
+++ b/src/libcore/tests/array.rs
@@ -242,7 +242,14 @@ fn iterator_drops() {
     assert_eq!(i.get(), 5);
 }
 
+// This test does not work on targets without panic=unwind support.
+// To work around this problem, test is marked is should_panic, so it will
+// be automagically skipped on unsuitable targets, such as
+// wasm32-unknown-unkown.
+//
+// It means that we use panic for indicating success.
 #[test]
+#[should_panic(expected = "test succeeded")]
 fn array_default_impl_avoids_leaks_on_panic() {
     use core::sync::atomic::{AtomicUsize, Ordering::Relaxed};
     static COUNTER: AtomicUsize = AtomicUsize::new(0);
@@ -274,6 +281,7 @@ fn array_default_impl_avoids_leaks_on_panic() {
     assert_eq!(*panic_msg, "bomb limit exceeded");
     // check that all bombs are successfully dropped
     assert_eq!(COUNTER.load(Relaxed), 0);
+    panic!("test succeeded")
 }
 
 #[test]