diff --git a/test/Cargo.toml b/test/Cargo.toml new file mode 100644 index 000000000..5a482d8ad --- /dev/null +++ b/test/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "test" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/test/src/lib.rs b/test/src/lib.rs new file mode 100644 index 000000000..32342580e --- /dev/null +++ b/test/src/lib.rs @@ -0,0 +1,46 @@ +//! This crate contains a very stripped down copy of the `test` crate. +//! `test` usually requires full `std` support, but we need to use it from a +//! `no_std` target. +//! The `test` crate is implicitly used by the `#[test]` attribute. +#![no_std] + +#[derive(Clone, Copy)] +pub struct TestDescAndFn { + pub testfn: StaticTestFn, + pub desc: TestDesc, +} + +#[derive(Clone, Copy)] +pub struct StaticTestFn(pub fn()); + +#[derive(Clone, Copy)] +pub struct TestDesc { + pub name: StaticTestName, + pub ignore: bool, + pub ignore_message: Option<&'static str>, + pub source_file: &'static str, + pub start_line: usize, + pub start_col: usize, + pub end_line: usize, + pub end_col: usize, + pub should_panic: ShouldPanic, + pub compile_fail: bool, + pub no_run: bool, + pub test_type: TestType, +} + +#[derive(Clone, Copy)] +pub struct StaticTestName(pub &'static str); + +#[derive(Clone, Copy)] +pub enum TestType { + UnitTest, +} + +#[derive(PartialEq, Eq, Clone, Copy)] +pub enum ShouldPanic { + Yes, + No, +} + +pub fn assert_test_result(_: ()) {}