Skip to content

Commit 2f0f278

Browse files
committed
Add a few more UI tests.
1 parent cc69b8e commit 2f0f278

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![no_main]
2+
3+
use msp430::interrupt::CriticalSection as CritSec;
4+
use msp430_rt_macros::{entry, interrupt};
5+
6+
// If we use "msp430::interrupt::CriticalSection", we get unused import warning for CritSec,
7+
// which is correct but misleading b/c of interrupt sig requirements.
8+
fn arg(_cs: msp430::interrupt::CriticalSection) {
9+
/* initialize hardware */
10+
}
11+
12+
#[entry]
13+
fn main() -> ! {
14+
unimplemented!()
15+
}
16+
17+
#[interrupt]
18+
fn TIM2(_cs: CritSec) {
19+
unimplemented!()
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: `#[interrupt]` handlers must have signature `[unsafe] fn([<name>: CriticalSection]) [-> !]`
2+
--> tests/ui/interrupt_bad_cs_import.rs:18:1
3+
|
4+
18 | fn TIM2(_cs: CritSec) {
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
7+
warning: unused import: `msp430::interrupt::CriticalSection as CritSec`
8+
--> tests/ui/interrupt_bad_cs_import.rs:3:5
9+
|
10+
3 | use msp430::interrupt::CriticalSection as CritSec;
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
|
13+
= note: `#[warn(unused_imports)]` on by default
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![no_main]
2+
3+
// Incorrect w/ bad error message- use of undeclared crate or module `interrupt`.
4+
use msp430_rt_macros::{entry, interrupt};
5+
6+
#[entry]
7+
fn main() -> ! {
8+
unimplemented!()
9+
}
10+
11+
#[interrupt]
12+
fn TIM2() {
13+
unimplemented!()
14+
}

0 commit comments

Comments
 (0)