Update tests to respect the way that macros work now.

This commit is contained in:
Paul Stansifer 2012-11-21 15:53:49 -05:00 committed by Graydon Hoare
parent 45bcb10204
commit e7f07cb2a3
4 changed files with 11 additions and 13 deletions

View File

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

View File

@ -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() {

View File

@ -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() {

View File

@ -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