Add regression test.

This commit is contained in:
Jeffrey Seyfried 2016-07-19 20:16:23 +00:00
parent b40b7ef0c4
commit 485e2df1b1

View File

@ -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);
}