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.
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.
11 // ignore-cross-compile
13 #![feature(quote, rustc_private)]
16 extern crate syntax_pos;
19 use syntax::codemap::FilePathMapping;
20 use syntax::print::pprust;
21 use syntax::symbol::Symbol;
22 use syntax_pos::DUMMY_SP;
25 let ps = syntax::parse::ParseSess::new(FilePathMapping::empty());
26 let mut resolver = syntax::ext::base::DummyResolver;
27 let mut cx = syntax::ext::base::ExtCtxt::new(
29 syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
33 assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23");
35 let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope
36 assert_eq!(pprust::expr_to_string(&*expr), "2 - $abcd + 7");