about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/run-pass/macro-2.rs13
-rw-r--r--src/test/run-pass/macro-3.rs7
-rw-r--r--src/test/run-pass/macro-by-example-1.rs7
-rw-r--r--src/test/run-pass/macro.rs12
4 files changed, 37 insertions, 2 deletions
diff --git a/src/test/run-pass/macro-2.rs b/src/test/run-pass/macro-2.rs
index 497742e9e4f..c1b20f650e5 100644
--- a/src/test/run-pass/macro-2.rs
+++ b/src/test/run-pass/macro-2.rs
@@ -1,9 +1,20 @@
+// xfail-pretty - token trees can't pretty print
+
 fn main() {
     #macro[[#mylambda[x, body],
             {
-                fn f(x: int) -> int { ret body }
+                fn f(x: int) -> int { ret body; }
                 f
             }]];
 
     assert (#mylambda[y, y * 2](8) == 16);
+
+    macro_rules! mylambda_tt{
+        {$x:ident, $body:expr} => {
+            fn f($x: int) -> int { ret $body; };
+            f
+        }
+    }
+
+    assert(mylambda_tt!{y, y * 2}(8) == 16)
 }
diff --git a/src/test/run-pass/macro-3.rs b/src/test/run-pass/macro-3.rs
index 3e8de676073..891d5a498b2 100644
--- a/src/test/run-pass/macro-3.rs
+++ b/src/test/run-pass/macro-3.rs
@@ -1,5 +1,12 @@
+// xfail-pretty - token trees can't pretty print
+
 fn main() {
     #macro[[#trivial[], 1 * 2 * 4 * 2 * 1]];
 
     assert (#trivial[] == 16);
+
+    macro_rules! trivial_tt{
+        {} => {1*2*4*2*1}
+    }
+    assert(trivial_tt!{} == 16);
 }
diff --git a/src/test/run-pass/macro-by-example-1.rs b/src/test/run-pass/macro-by-example-1.rs
index 520adef92eb..5c04e1f2bb7 100644
--- a/src/test/run-pass/macro-by-example-1.rs
+++ b/src/test/run-pass/macro-by-example-1.rs
@@ -1,7 +1,14 @@
+// xfail-pretty - token trees can't pretty print
+
 fn main() {
     #macro[[#apply[f, [x, ...]], f(x, ...)]];
 
+    macro_rules! apply_tt{
+        {$f:expr, ($($x:expr),*)} => {$f($($x),*)}
+    }
+
     fn add(a: int, b: int) -> int { ret a + b; }
 
     assert (#apply[add, [1, 15]] == 16);
+    assert(apply_tt!{add, (1, 15)} == 16);
 }
diff --git a/src/test/run-pass/macro.rs b/src/test/run-pass/macro.rs
index 66f2ccc6a89..0f4350c5d8e 100644
--- a/src/test/run-pass/macro.rs
+++ b/src/test/run-pass/macro.rs
@@ -1 +1,11 @@
-fn main() { #macro[[#m1[a], a * 4]]; assert (#m1[2] == 8); }
+// xfail-pretty - token trees can't pretty print
+
+fn main() {
+    #macro[[#m1[a], a * 4]];
+    assert (#m1[2] == 8);
+
+    macro_rules! m1tt {
+        {$a:expr} => {$a*4}
+    };
+    assert(m1tt!{2} == 8);
+}