From 485e2df1b1fbd4acde8dbc5bfbdf7fed3acc227c Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Tue, 19 Jul 2016 20:16:23 +0000 Subject: [PATCH] Add regression test. --- src/test/run-pass/macro-of-higher-order.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/run-pass/macro-of-higher-order.rs b/src/test/run-pass/macro-of-higher-order.rs index 52e19b37d7935..c982e8ac6f83e 100644 --- a/src/test/run-pass/macro-of-higher-order.rs +++ b/src/test/run-pass/macro-of-higher-order.rs @@ -16,7 +16,16 @@ macro_rules! higher_order { }); } +macro_rules! outer { + ($x:expr; $fragment:ident) => { + macro_rules! inner { ($y:$fragment) => { $x + $y } } + } +} + fn main() { let val = higher_order!(subst ($x:expr, $y:expr, $foo:expr) => (($x + $y, $foo))); assert_eq!(val, (3, "foo")); + + outer!(2; expr); + assert_eq!(inner!(3), 5); }