From e7f07cb2a377628922b337fdd08ca2dbbb14f2a5 Mon Sep 17 00:00:00 2001 From: Paul Stansifer Date: Wed, 21 Nov 2012 15:53:49 -0500 Subject: [PATCH] Update tests to respect the way that macros work now. --- src/test/run-pass/macro-2.rs | 4 ++-- src/test/run-pass/macro-interpolation.rs | 4 ++-- src/test/run-pass/macro-path.rs | 12 +++++------- src/test/run-pass/pipe-presentation-examples.rs | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/test/run-pass/macro-2.rs b/src/test/run-pass/macro-2.rs index 595583d2cefe..f342f5db140b 100644 --- a/src/test/run-pass/macro-2.rs +++ b/src/test/run-pass/macro-2.rs @@ -3,10 +3,10 @@ fn main() { macro_rules! mylambda_tt( - ($x:ident, $body:expr) => { + ($x:ident, $body:expr) => ({ fn f($x: int) -> int { return $body; }; f - } + }) ) assert(mylambda_tt!(y, y * 2)(8) == 16) diff --git a/src/test/run-pass/macro-interpolation.rs b/src/test/run-pass/macro-interpolation.rs index 6ee4ac878077..d5e5fe1b489b 100644 --- a/src/test/run-pass/macro-interpolation.rs +++ b/src/test/run-pass/macro-interpolation.rs @@ -1,7 +1,7 @@ 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) => { @@ -9,7 +9,7 @@ macro_rules! overly_complicated ( } _ => { fail; } } - } + }) ) fn main() { diff --git a/src/test/run-pass/macro-path.rs b/src/test/run-pass/macro-path.rs index 6c5a944ee291..d54fef5c260d 100644 --- a/src/test/run-pass/macro-path.rs +++ b/src/test/run-pass/macro-path.rs @@ -2,13 +2,11 @@ mod m { pub type t = int; } -fn macros() { - macro_rules! foo { - ($p:path) => { - fn f() -> $p { 10 } - f() - } - } +macro_rules! foo { + ($p:path) => ({ + fn f() -> $p { 10 }; + f() + }) } fn main() { diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index e29eb9787c0a..6b07f88a8a96 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -54,12 +54,12 @@ macro_rules! select ( $($message:path$(($($x: ident),+))dont_type_this* -> $next:ident $e:expr),+ } )+ - } => { + } => ({ let index = pipes::selecti([$(($port).header()),+]); select_if!(index, 0, $( $port => [ $($message$(($($x),+))dont_type_this* -> $next $e),+ ], )+) - } + }) ) // Types and protocols