Skip to content

Commit 2f21458

Browse files
committed
Add test for invalid type
1 parent c5970ab commit 2f21458

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

tests/trybuild_tests.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#[test]
2-
fn ui_tests() {
2+
fn bitmap_too_large() {
33
let t = trybuild::TestCases::new();
44
t.compile_fail("tests/ui/bitmap_too_large.rs");
55
}
6+
7+
#[test]
8+
fn invalid_type() {
9+
let t = trybuild::TestCases::new();
10+
t.compile_fail("tests/ui/invalid_type.rs");
11+
}

tests/ui/invalid_type.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use macros::bitmap;
2+
3+
fn main() {
4+
bitmap!(
5+
struct Bits {
6+
field0: u8,
7+
}
8+
);
9+
}

tests/ui/invalid_type.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: Expected one of u1, u2, u3, u4, u5, u6, and u7
2+
--> tests/ui/invalid_type.rs:6:21
3+
|
4+
6 | field0: u8,
5+
| ^^

0 commit comments

Comments
 (0)