diff options
| author | John Clements <clements@racket-lang.org> | 2014-06-26 17:41:43 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2014-06-27 22:08:57 -0700 |
| commit | ee1ee7f463240ebda33d2180dd54be7a5e7f923c (patch) | |
| tree | 7781560b31e4d3c4aca3c8100f3cbd34981897aa | |
| parent | 235ca1801ec8053b7cab46ed6708c382e58df63b (diff) | |
| download | rust-ee1ee7f463240ebda33d2180dd54be7a5e7f923c.tar.gz rust-ee1ee7f463240ebda33d2180dd54be7a5e7f923c.zip | |
make tests hygienic...
... and possibly totally pointless. Specifically, fixing these to make their macros hygienic may mean that they no longer test the thing that they were supposed to test.
| -rw-r--r-- | src/test/run-pass/issue-8851.rs | 13 | ||||
| -rw-r--r-- | src/test/run-pass/typeck-macro-interaction-issue-8852.rs | 13 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/test/run-pass/issue-8851.rs b/src/test/run-pass/issue-8851.rs index 62970369579..21037120569 100644 --- a/src/test/run-pass/issue-8851.rs +++ b/src/test/run-pass/issue-8851.rs @@ -10,23 +10,28 @@ #![feature(macro_rules)] +// after fixing #9384 and implementing hygiene for match bindings, +// this now fails because the insertion of the 'y' into the match +// doesn't cause capture. Making this macro hygienic (as I've done) +// could very well make this test case completely pointless.... + enum T { A(int), B(uint) } macro_rules! test( - ($e:expr) => ( + ($id:ident, $e:expr) => ( fn foo(t: T) -> int { match t { - A(y) => $e, - B(y) => $e + A($id) => $e, + B($id) => $e } } ) ) -test!(10 + (y as int)) +test!(y, 10 + (y as int)) pub fn main() { foo(A(20)); diff --git a/src/test/run-pass/typeck-macro-interaction-issue-8852.rs b/src/test/run-pass/typeck-macro-interaction-issue-8852.rs index 50ef1922c8f..6be79cb62dd 100644 --- a/src/test/run-pass/typeck-macro-interaction-issue-8852.rs +++ b/src/test/run-pass/typeck-macro-interaction-issue-8852.rs @@ -15,19 +15,24 @@ enum T { B(f64) } +// after fixing #9384 and implementing hygiene for match bindings, +// this now fails because the insertion of the 'y' into the match +// doesn't cause capture. Making this macro hygienic (as I've done) +// could very well make this test case completely pointless.... + macro_rules! test( - ($e:expr) => ( + ($id1:ident, $id2:ident, $e:expr) => ( fn foo(a:T, b:T) -> T { match (a, b) { - (A(x), A(y)) => A($e), - (B(x), B(y)) => B($e), + (A($id1), A($id2)) => A($e), + (B($id1), B($id2)) => B($e), _ => fail!() } } ) ) -test!(x + y) +test!(x,y,x + y) pub fn main() { foo(A(1), A(2)); |
