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