add unit tests (#60)

also, flatten the workspace into a single crate. I forget what the original reason for the workspace
was -- I think it was added because `cargo t -p testsuite` is nicer than running
`cargo t --test $filename` N times. However, a single crate removes the need to repeat the list of
dependencies in `testsuite/Cargo.toml`

also, document the two sets of tests included with the template and how to run them in the README
file
This commit is contained in:
Jorge Aparicio
2022-01-03 11:29:08 +01:00
committed by GitHub
parent d82fad8c96
commit 47277bbf9d
7 changed files with 72 additions and 55 deletions
+15
View File
@@ -1,3 +1,4 @@
#![no_main]
#![no_std]
use defmt_rtt as _; // global logger
@@ -20,3 +21,17 @@ pub fn exit() -> ! {
cortex_m::asm::bkpt();
}
}
// defmt-test 0.3.0 has the limitation that this `#[tests]` attribute can only be used
// once within a crate. the module can be in any file but there can only be at most
// one `#[tests]` module in this library crate
#[cfg(test)]
#[defmt_test::tests]
mod unit_tests {
use defmt::assert;
#[test]
fn it_works() {
assert!(true)
}
}