From 73925f5758dfae653d920c380242607fc48ca1c4 Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Thu, 28 Nov 2024 16:15:19 -0500 Subject: [PATCH] Make sourcepos! work in static contexts --- src/tests.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/tests.rs b/src/tests.rs index 9182b24d..e143709f 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -238,10 +238,19 @@ fn asssert_node_eq<'a>(node: &'a AstNode<'a>, location: &[usize], expected: &Nod macro_rules! sourcepos { (($spsl:literal:$spsc:literal-$spel:literal:$spec:literal)) => { - ($spsl, $spsc, $spel, $spec).into() + $crate::nodes::Sourcepos { + start: $crate::nodes::LineColumn { + line: $spsl, + column: $spsc, + }, + end: $crate::nodes::LineColumn { + line: $spel, + column: $spec, + }, + } }; ((XXX)) => { - (0, 1, 0, 1).into() + $crate::tests::sourcepos!((0:1-0:1)) }; }