Skip to content

Commit

Permalink
Add trybuild crate to run ui tests
Browse files Browse the repository at this point in the history
* add example file that should fail to compile due to an incompatible
  type (`() instead of `i32``)
  • Loading branch information
justahero committed Oct 27, 2021
1 parent 9d2a885 commit 49b82a6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions firmware/defmt-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ defmt-info = []
defmt-warn = []
defmt-error = []
default = ["defmt-trace"] # enable everything

[dev-dependencies]
trybuild = "1"
5 changes: 5 additions & 0 deletions firmware/defmt-test/tests/ui.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");
}
10 changes: 10 additions & 0 deletions firmware/defmt-test/tests/ui/test-uses-invalid-type-annotation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fn main() {}

#[defmt_test::tests]
mod tests {
#[test]
#[ignore]
fn assert_eq() {
let x: () = 42;
}
}
Empty file.

0 comments on commit 49b82a6

Please sign in to comment.