From c749979c458472c8e7e719b17a6d6906c7ddf3e0 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 23 Feb 2019 21:50:52 +0100 Subject: [PATCH] add some tests --- tests/cfail/used-free-interrupt-2.rs | 21 +++++++++++++++++++++ tests/cpass/binds.rs | 25 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/cfail/used-free-interrupt-2.rs create mode 100644 tests/cpass/binds.rs diff --git a/tests/cfail/used-free-interrupt-2.rs b/tests/cfail/used-free-interrupt-2.rs new file mode 100644 index 0000000000..f9aab78efd --- /dev/null +++ b/tests/cfail/used-free-interrupt-2.rs @@ -0,0 +1,21 @@ +#![no_main] +#![no_std] + +extern crate lm3s6965; +extern crate panic_halt; +extern crate rtfm; + +use rtfm::app; + +#[app(device = lm3s6965)] +const APP: () = { + #[init] + fn init() {} + + #[interrupt(binds = UART0)] + fn foo() {} //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers + + extern "C" { + fn UART0(); + } +}; diff --git a/tests/cpass/binds.rs b/tests/cpass/binds.rs new file mode 100644 index 0000000000..361f08fc93 --- /dev/null +++ b/tests/cpass/binds.rs @@ -0,0 +1,25 @@ +//! Check that `binds` works as advertised +#![no_main] +#![no_std] + +extern crate lm3s6965; +extern crate panic_halt; +extern crate rtfm; + +use rtfm::app; + +#[app(device = lm3s6965)] +const APP: () = { + #[init] + fn init() {} + + #[exception(binds = SVCall)] + fn foo() {} + + #[interrupt(binds = UART0)] + fn bar() {} +}; + +fn foo_trampoline(_: foo::Context) {} + +fn bar_trampoline(_: bar::Context) {}