summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorPaul Stansifer <paul.stansifer@gmail.com>2011-08-02 12:22:17 -0700
committerPaul Stansifer <paul.stansifer@gmail.com>2011-08-02 14:46:02 -0700
commitab4764520c41a5ef5e0987b69e1673445bc40d0f (patch)
treeef996f561fff859f35da54758e43afc2228a6de2 /src/test
parentea2a9681460c112e968a54f0d3378a0fab40e7b1 (diff)
downloadrust-ab4764520c41a5ef5e0987b69e1673445bc40d0f.tar.gz
rust-ab4764520c41a5ef5e0987b69e1673445bc40d0f.zip
Allow patterns of the form `[a, b, c ...] to be matched and transcribed.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/macro-2.rs4
-rw-r--r--src/test/run-pass/macro-3.rs4
-rw-r--r--src/test/run-pass/macro-by-example-1.rs4
-rw-r--r--src/test/run-pass/macro-by-example-2.rs12
-rw-r--r--src/test/run-pass/macro.rs4
5 files changed, 19 insertions, 9 deletions
diff --git a/src/test/run-pass/macro-2.rs b/src/test/run-pass/macro-2.rs
index 0cd21a830eb..5a3973c79e3 100644
--- a/src/test/run-pass/macro-2.rs
+++ b/src/test/run-pass/macro-2.rs
@@ -1,7 +1,7 @@
 // xfail-stage0
 
 fn main() {
-  #macro([#mylambda(x,body), {fn f(x: int) -> int { ret body }; f}]);
+  #macro([#mylambda[x,body], {fn f(x: int) -> int { ret body }; f}]);
 
-  assert(#mylambda(y,y*2)(8) == 16);
+  assert(#mylambda[y,y*2](8) == 16);
 }
\ No newline at end of file
diff --git a/src/test/run-pass/macro-3.rs b/src/test/run-pass/macro-3.rs
index c14d8943083..ab4599327b9 100644
--- a/src/test/run-pass/macro-3.rs
+++ b/src/test/run-pass/macro-3.rs
@@ -1,7 +1,7 @@
 // xfail-stage0
 
 fn main() {
-  #macro([#trivial(), 1*2*4*2*1]);
+  #macro([#trivial[], 1*2*4*2*1]);
 
-  assert(#trivial() == 16);
+  assert(#trivial[] == 16);
 }
diff --git a/src/test/run-pass/macro-by-example-1.rs b/src/test/run-pass/macro-by-example-1.rs
index ef127049e09..08e5c4e249f 100644
--- a/src/test/run-pass/macro-by-example-1.rs
+++ b/src/test/run-pass/macro-by-example-1.rs
@@ -1,7 +1,7 @@
 fn main() {
-    #macro([#apply(f, [x, ...]), f(x, ...)]);
+    #macro([#apply[f, [x, ...]], f(x, ...)]);
 
     fn add(a: int, b: int) -> int { ret a + b; }
 
-    assert (#apply(add, [1, 15]) == 16);
+    assert (#apply[add, [1, 15]] == 16);
 }
\ No newline at end of file
diff --git a/src/test/run-pass/macro-by-example-2.rs b/src/test/run-pass/macro-by-example-2.rs
index c6bcc9323f8..382d06be37b 100644
--- a/src/test/run-pass/macro-by-example-2.rs
+++ b/src/test/run-pass/macro-by-example-2.rs
@@ -31,6 +31,16 @@ fn main() {
             }]);
 
 
-    assert ((#lambda[i, #<uint>, i + 4u, #<uint>])(12u) == 16u)
+    assert ((#lambda[i, #<uint>, i + 4u, #<uint>])(12u) == 16u);
+
+    #macro[[#sum[x, xs, ...], x + #sum[xs, ...]],
+           [#sum[], 0]];
+
+    assert (#sum[1,2,3,4] == 10);
+
+
+    #macro[[#transcr_mixed[a, as, ...], #sum[6, as, ...] * a]];
+
+    assert (#transcr_mixed[10, 5, 4, 3, 2, 1] == 210);
 
 }
\ No newline at end of file
diff --git a/src/test/run-pass/macro.rs b/src/test/run-pass/macro.rs
index f82e37deea2..9f001e93d2f 100644
--- a/src/test/run-pass/macro.rs
+++ b/src/test/run-pass/macro.rs
@@ -1,6 +1,6 @@
 // xfail-stage0
 
 fn main() {
-  #macro([#m1(a), a*4]);
-  assert (#m1(2) == 8);
+  #macro[[#m1[a], a*4]];
+  assert (#m1[2] == 8);
 }