mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 06:46:32 +03:00
Rust-tests: Don't panic while panicking
This commit is contained in:
@@ -2,11 +2,11 @@
|
|||||||
//!
|
//!
|
||||||
//! This private module is only compiled for test runs.
|
//! This private module is only compiled for test runs.
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{collections::BTreeMap, panic};
|
use std::{collections::BTreeMap, panic};
|
||||||
|
use std::{fmt, thread};
|
||||||
|
|
||||||
use ansi_term::Color;
|
use ansi_term::Color;
|
||||||
use async_std::future::Future;
|
use async_std::future::Future;
|
||||||
@@ -423,8 +423,10 @@ impl Deref for TestContext {
|
|||||||
|
|
||||||
impl Drop for TestContext {
|
impl Drop for TestContext {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Ok(p) = self.poison_receiver.try_recv() {
|
if !thread::panicking() {
|
||||||
panic!(p);
|
if let Ok(p) = self.poison_receiver.try_recv() {
|
||||||
|
panic!(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user