1#![no_std]
4#![cfg_attr(test, no_main)]
5#![feature(custom_test_frameworks)]
6#![test_runner(crate::test_runner)]
7#![reexport_test_harness_main = "test_main"]
8
9#[allow(missing_docs)]
15pub trait Testable
16{
17 fn run(&self) -> ();
18}
19
20impl<T> Testable for T
21where
22 T: Fn(),
23{
24 fn run(&self)
25 {
26 mango_core::print!("{}...\t", core::any::type_name::<T>());
27 self();
28 mango_core::println!("[ok]");
29 }
30}
31
32#[allow(missing_docs)]
33pub fn test_runner(tests: &[&dyn Testable])
34{
35 mango_core::println!("Running {} tests", tests.len());
36 for test in tests
37 {
38 test.run();
39 }
40 #[cfg(feature = "qemu")]
41 mango_core::qemu::exit_qemu(mango_core::qemu::QemuExitCode::Success);
42}