1#![no_std]
2
3pub use mos_test_macros::tests;
4
5#[doc(hidden)]
7pub mod export;
8
9use ufmt_stdio::ufmt::uDisplay;
10
11pub trait TestOutcome: uDisplay {
12 fn is_success(&self) -> bool;
13}
14
15pub struct OutcomeWrapper<T>(pub T);
16
17impl uDisplay for OutcomeWrapper<()> {
18 fn fmt<W>(&self, fmt: &mut ufmt_stdio::ufmt::Formatter<'_, W>) -> Result<(), W::Error>
19 where
20 W: ufmt_stdio::uWrite + ?Sized,
21 {
22 fmt.write_str("()")
23 }
24}
25impl<T: uDisplay, E: uDisplay> uDisplay for OutcomeWrapper<Result<T, E>> {
26 fn fmt<W>(&self, fmt: &mut ufmt_stdio::ufmt::Formatter<'_, W>) -> Result<(), W::Error>
27 where
28 W: ufmt_stdio::uWrite + ?Sized,
29 {
30 match &self.0 {
31 Ok(v) => v.fmt(fmt),
32 Err(v) => v.fmt(fmt),
33 }
34 }
35}
36
37impl<T: uDisplay, E: uDisplay> TestOutcome for OutcomeWrapper<Result<T, E>> {
38 fn is_success(&self) -> bool {
39 self.0.is_ok()
40 }
41}
42
43impl TestOutcome for OutcomeWrapper<()> {
44 fn is_success(&self) -> bool {
45 true
46 }
47}