Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Commit e58549b

Browse files
committed
Add more documentation for testing on host
1 parent 0e2aadf commit e58549b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/test_on_host.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
//! Conditionally compiling tests with std and our executable with no_std.
22
//!
3+
//! Rust's built in unit testing framework requires the standard library,
4+
//! but we need to build our final executable with no_std.
5+
//! The testing framework also generates a `main` method, so we need to only use the `#[entry]`
6+
//! annotation when building our final image.
7+
//! For more information on why this example works, see this excellent blog post.
8+
//! https://os.phil-opp.com/unit-testing/
9+
//!
10+
//! Running this example:
11+
//!
312
//! Ensure there are no targets specified under `[build]` in `.cargo/config`
413
//! In order to make this work, we lose the convenience of having a default target that isn't the
514
//! host.

0 commit comments

Comments
 (0)