/src/test/run-pass/macro-2.rs
http://github.com/jruderman/rust · Rust · 20 lines · 15 code · 4 blank · 1 comment · 2 complexity · 64526cf652ccbc2ec79562f9a311ee4f MD5 · raw file
- // xfail-pretty - token trees can't pretty print
- fn main() {
- #macro[[#mylambda[x, body],
- {
- fn f(x: int) -> int { return body; }
- f
- }]];
- assert (mylambda!{y, y * 2}(8) == 16);
- macro_rules! mylambda_tt{
- {$x:ident, $body:expr} => {
- fn f($x: int) -> int { return $body; };
- f
- }
- }
- assert(mylambda_tt!{y, y * 2}(8) == 16)
- }