Skip to content

Commit 647289a

Browse files
authored
Merge pull request #29 from knurling-rs/defmt-test
use defmt-test in the test suite
2 parents f12e76f + 6c5aa23 commit 647289a

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
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`" }

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,12 @@ In the example output, the supported version is `3db6b41f08a5c866e6d6ed7103d01b0
158158
-# [patch.crates-io]
159159
-# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
160160
-# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
161+
-# defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
161162
-# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" }
162163
+[patch.crates-io]
163164
+defmt = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" }
164165
+defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" }
166+
+defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" }
165167
+panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" }
166168
```
167169

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: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#![no_std]
22
#![no_main]
33

4-
use cortex_m_rt::entry;
54
use {{crate_name}} as _; // memory layout + panic handler
65

7-
#[entry]
8-
fn main() -> ! {
9-
assert!(false, "TODO: Write actual tests");
6+
// See https://crates.io/crates/defmt-test/0.1.0 for more documentation (e.g. about the 'state'
7+
// feature)
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)