]> git.proxmox.com Git - rustc.git/blame - src/test/parse-fail/qquote-2.rs
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / test / parse-fail / qquote-2.rs
CommitLineData
1a4d82fc 1// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
223e47cc
LB
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
1a4d82fc 11// ignore-test Can't use syntax crate here
223e47cc 12
1a4d82fc 13#![feature(quote)]
223e47cc 14
1a4d82fc 15extern crate syntax;
223e47cc
LB
16
17use syntax::diagnostic;
18use syntax::ast;
19use syntax::codemap;
20use syntax::parse::parser;
21use syntax::print::*;
22
23trait fake_ext_ctxt {
1a4d82fc 24 fn cfg() -> ast::CrateConfig;
223e47cc
LB
25 fn parse_sess() -> parse::parse_sess;
26 fn call_site() -> span;
970d7e83 27 fn ident_of(st: &str) -> ast::ident;
223e47cc
LB
28}
29
30type fake_session = parse::parse_sess;
31
32impl fake_ext_ctxt for fake_session {
1a4d82fc 33 fn cfg() -> ast::CrateConfig { Vec::new() }
223e47cc
LB
34 fn parse_sess() -> parse::parse_sess { self }
35 fn call_site() -> span {
36 codemap::span {
37 lo: codemap::BytePos(0),
38 hi: codemap::BytePos(0),
1a4d82fc 39 expn_id: codemap::NO_EXPANSION
223e47cc
LB
40 }
41 }
970d7e83
LB
42 fn ident_of(st: &str) -> ast::ident {
43 self.interner.intern(st)
223e47cc
LB
44 }
45}
46
47fn mk_ctxt() -> fake_ext_ctxt {
48 parse::new_parse_sess(None) as fake_ext_ctxt
49}
50
51
52fn main() {
1a4d82fc 53 let cx = mk_ctxt();
223e47cc 54
1a4d82fc 55 let stmt = quote_stmt!(cx, let x isize = 20;); //~ ERROR expected end-of-string
223e47cc
LB
56 check_pp(*stmt, pprust::print_stmt, "");
57}
58
1a4d82fc
JJ
59fn check_pp<T>(expr: T, f: |pprust::ps, T|, expect: str) {
60 panic!();
223e47cc 61}