| Crates.io | embedded_test_harness |
| lib.rs | embedded_test_harness |
| version | 0.1.1 |
| created_at | 2022-06-28 09:42:24.283484+00 |
| updated_at | 2022-06-28 11:51:42.653169+00 |
| description | Rust no_std test harness |
| homepage | |
| repository | https://github.com/aiooss-ledger/embedded_test_harness/ |
| max_upload_size | |
| id | 614731 |
| size | 6,255 |
no_stdOnly supports ARM Cortex-M semi-hosting for now.
Add embedded_test_harness and
testmacro = { git = "https://github.com/yhql/testmacro"}
to Cargo.toml dev-dependencies.
Then you may write tests following this template:
#![no_std]
#![cfg_attr(test, no_main)]
#![reexport_test_harness_main = "test_main"]
#![feature(custom_test_frameworks)]
#![test_runner(test_runner)]
use panic_semihosting as _;
#[cfg(test)]
use embedded_test_harness::test_runner;
#[cfg(test)]
mod tests {
use testmacro::test_item as test;
use embedded_test_harness::TestType;
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
/// _start is the entrypoint specified in the linker
#[no_mangle]
pub fn _start() -> ! {
#[cfg(test)]
test_main();
loop {}
}