summary refs log tree commit diff
path: root/src/test/run-pass/macro-interpolation.rs
blob: 6ee4ac8780779cc8f1867edec8812ba070f758df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

macro_rules! overly_complicated (
    ($fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path) =>
    {
        fn $fnname($arg: $ty) -> Option<$ty> $body
        match $fnname($val) {
          Some($pat) => {
            $res
          }
          _ => { fail; }
        }
    }

)
fn main() {
    assert overly_complicated!(f, x, Option<uint>, { return Some(x); },
                               Some(8u), Some(y), y) == 8u

}