diff --git a/src/test/mod.rs b/src/test/mod.rs new file mode 100644 index 0000000000000000000000000000000000000000..19df860ad7ae855b0c1309654005b8f1956e7aa3 --- /dev/null +++ b/src/test/mod.rs @@ -0,0 +1,25 @@ +use core::fmt::Debug; + +mod connector; +mod setup; + +struct Panicked(Box); +impl Debug for Panicked { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + if let Some(str_slice) = self.0.downcast_ref::<&'static str>() { + f.pad(str_slice) + } else if let Some(string) = self.0.downcast_ref::() { + f.pad(string) + } else { + f.pad("Box") + } + } +} +fn handle(result: Result<(), std::boxed::Box<(dyn std::any::Any + std::marker::Send + 'static)>>) { + match result { + Ok(_) => {} + Err(x) => { + panic!("Worker panicked: {:?}", Panicked(x)); + } + } +}