From cc6c1ad3f384ac4021d55236c5e576eb288028dc Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 12 Apr 2017 16:05:48 -0500 Subject: add cfail tests for the tasks! macro --- tests/cfail/tasks-wrong-priority.rs | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/cfail/tasks-wrong-priority.rs (limited to 'tests/cfail/tasks-wrong-priority.rs') diff --git a/tests/cfail/tasks-wrong-priority.rs b/tests/cfail/tasks-wrong-priority.rs new file mode 100644 index 0000000..741a96a --- /dev/null +++ b/tests/cfail/tasks-wrong-priority.rs @@ -0,0 +1,54 @@ +// error-pattern: mismatched types + +#![feature(used)] + +extern crate core; +extern crate cortex_m; +#[macro_use] +extern crate cortex_m_srp; + +use cortex_m_srp::{C16, P0, P1, P2}; +use device::interrupt::Exti1; + +tasks!(device, { + j1: (Exti0, P1), +}); + +fn init(_: C16) {} + +fn idle(_: P0) {} + +// Wrong priority token. Declared P1, got P2 +fn j1(_task: Exti1, _prio: P1) {} + +mod device { + pub mod interrupt { + use cortex_m::interrupt::Nr; + + extern "C" fn default_handler(_: T) {} + + pub struct Handlers { + pub Exti0: extern "C" fn(Exti0), + pub Exti1: extern "C" fn(Exti1), + } + + pub struct Exti0; + pub struct Exti1; + + pub enum Interrupt { + Exti0, + Exti1, + } + + unsafe impl Nr for Interrupt { + fn nr(&self) -> u8 { + 0 + } + } + + pub const DEFAULT_HANDLERS: Handlers = Handlers { + Exti0: default_handler, + Exti1: default_handler, + }; + } +} -- cgit v1.2.3