]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-fulldeps/quote-tokens.rs
test: Automatically remove all `~[T]` from tests.
[rust.git] / src / test / run-pass-fulldeps / quote-tokens.rs
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // ignore-test
12
13 #[feature(quote)];
14 #[feature(managed_boxes)];
15
16 extern crate syntax;
17
18 use syntax::ext::base::ExtCtxt;
19
20 fn syntax_extension(cx: &ExtCtxt) {
21     let e_toks : Vec<syntax::ast::token_tree> = quote_tokens!(cx, 1 + 2);
22     let p_toks : Vec<syntax::ast::token_tree> = quote_tokens!(cx, (x, 1 .. 4, *));
23
24     let a: @syntax::ast::Expr = quote_expr!(cx, 1 + 2);
25     let _b: Option<@syntax::ast::item> = quote_item!(cx, static foo : int = $e_toks; );
26     let _c: @syntax::ast::Pat = quote_pat!(cx, (x, 1 .. 4, *) );
27     let _d: @syntax::ast::Stmt = quote_stmt!(cx, let x = $a; );
28     let _e: @syntax::ast::Expr = quote_expr!(cx, match foo { $p_toks => 10 } );
29 }
30
31 fn main() {
32 }