diff --git a/examples/test_on_host.rs b/examples/test_on_host.rs index b5f386b..1c75ed1 100644 --- a/examples/test_on_host.rs +++ b/examples/test_on_host.rs @@ -1,5 +1,14 @@ //! Conditionally compiling tests with std and our executable with no_std. //! +//! Rust's built in unit testing framework requires the standard library, +//! but we need to build our final executable with no_std. +//! The testing framework also generates a `main` method, so we need to only use the `#[entry]` +//! annotation when building our final image. +//! For more information on why this example works, see this excellent blog post. +//! https://os.phil-opp.com/unit-testing/ +//! +//! Running this example: +//! //! Ensure there are no targets specified under `[build]` in `.cargo/config` //! In order to make this work, we lose the convenience of having a default target that isn't the //! host.