1#![cfg_attr(not(feature = "std"), no_std)]
4#![allow(clippy::needless_doctest_main)]
5#![cfg_attr(not(doctest), doc = include_str!("../README.md"))]
6
7mod fmt;
8
9pub use embedded_test_macros::tests;
10
11#[cfg(all(feature = "panic-handler", not(feature = "ariel-os")))]
12#[panic_handler]
13fn panic(info: &core::panic::PanicInfo) -> ! {
14 error!("====================== PANIC ======================");
15
16 error!("{}", info);
17
18 semihosting::process::abort()
19}
20
21#[doc(hidden)]
24pub mod export;
25
26mod sealed {
27 pub trait Sealed {}
28 impl Sealed for () {}
29 impl<T, E> Sealed for Result<T, E> {}
30}
31
32#[cfg(feature = "defmt")]
38pub trait TestOutcome: defmt::Format + sealed::Sealed {
39 fn is_success(&self) -> bool;
40}
41
42#[cfg(feature = "log")]
48pub trait TestOutcome: core::fmt::Debug + sealed::Sealed {
49 fn is_success(&self) -> bool;
50}
51
52#[cfg(all(not(feature = "log"), not(feature = "defmt")))]
58pub trait TestOutcome: sealed::Sealed {
59 fn is_success(&self) -> bool;
60}
61
62impl TestOutcome for () {
63 fn is_success(&self) -> bool {
64 true
65 }
66}
67
68#[cfg(feature = "log")]
69impl<T: core::fmt::Debug, E: core::fmt::Debug> TestOutcome for Result<T, E> {
70 fn is_success(&self) -> bool {
71 self.is_ok()
72 }
73}
74
75#[cfg(feature = "defmt")]
76impl<T: defmt::Format, E: defmt::Format> TestOutcome for Result<T, E> {
77 fn is_success(&self) -> bool {
78 self.is_ok()
79 }
80}
81
82#[cfg(all(not(feature = "log"), not(feature = "defmt")))]
83impl<T, E> TestOutcome for Result<T, E> {
84 fn is_success(&self) -> bool {
85 self.is_ok()
86 }
87}