Skip to content

Commit e5cf89b

Browse files
committed
use defmt-test in the test suite
1 parent c99696d commit e5cf89b

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ overflow-checks = false # <-
5454
# [patch.crates-io]
5555
# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
5656
# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
57+
# defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
5758
# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }

testsuite/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cortex-m = "0.6.3"
1616
cortex-m-rt = "0.6.12"
1717
defmt = "0.1.0"
1818
defmt-rtt = "0.1.0"
19+
defmt-test = "0.1.0"
1920
panic-probe = { version = "0.1.0", features = ["print-defmt" ] }
2021

2122
[features]

testsuite/tests/test.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
use cortex_m_rt::entry;
55
use {{crate_name}} as _; // memory layout + panic handler
66

7-
#[entry]
8-
fn main() -> ! {
9-
assert!(false, "TODO: Write actual tests");
7+
// See https://crates.io/crates/defmt-test/0.1.0 for more documentation
8+
#[defmt_test::tests]
9+
mod tests {
10+
#[test]
11+
fn assert_true() {
12+
assert!(true)
13+
}
1014

11-
{{crate_name}}::exit();
15+
#[test]
16+
fn assert_false() {
17+
assert!(false, "TODO: write actual tests")
18+
}
1219
}

0 commit comments

Comments
 (0)