aboutsummaryrefslogtreecommitdiff
path: root/macros/src/tests/single.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/tests/single.rs')
-rw-r--r--macros/src/tests/single.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/macros/src/tests/single.rs b/macros/src/tests/single.rs
new file mode 100644
index 00000000..97cbbb3f
--- /dev/null
+++ b/macros/src/tests/single.rs
@@ -0,0 +1,34 @@
+use quote::quote;
+use rtic_syntax::Settings;
+
+#[test]
+fn analyze() {
+ let mut settings = Settings::default();
+ settings.parse_extern_interrupt = true;
+ let (app, analysis) = rtic_syntax::parse2(
+ quote!(device = pac),
+ quote!(
+ mod app {
+ #[task(priority = 1)]
+ fn a(_: a::Context) {}
+
+ #[task(priority = 2)]
+ fn b(_: b::Context) {}
+
+ // First interrupt is assigned to the highest priority dispatcher
+ extern "C" {
+ fn B();
+ fn A();
+ }
+ }
+ ),
+ settings,
+ )
+ .unwrap();
+
+ let analysis = crate::analyze::app(analysis, &app);
+ let interrupts = &analysis.interrupts;
+ assert_eq!(interrupts.len(), 2);
+ assert_eq!(interrupts[&2].to_string(), "B");
+ assert_eq!(interrupts[&1].to_string(), "A");
+}