Skip to content

Commit

Permalink
Add regression test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Jul 19, 2016
1 parent b40b7ef commit 485e2df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/run-pass/macro-of-higher-order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 485e2df

Please sign in to comment.