Skip to content

Commit e22dd3e

Browse files
committed
qquote-1.rs -> compile-fail-fulldeps/qquote.rs
Re-enables the test.
1 parent c3f1d18 commit e22dd3e

File tree

2 files changed

+55
-70
lines changed

2 files changed

+55
-70
lines changed
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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-cross-compile
12+
13+
#![feature(quote, rustc_private)]
14+
15+
extern crate syntax;
16+
17+
use syntax::ast;
18+
use syntax::codemap;
19+
use syntax::parse;
20+
use syntax::print::pprust;
21+
22+
trait FakeExtCtxt {
23+
fn call_site(&self) -> codemap::Span;
24+
fn cfg(&self) -> ast::CrateConfig;
25+
fn ident_of(&self, st: &str) -> ast::Ident;
26+
fn name_of(&self, st: &str) -> ast::Name;
27+
fn parse_sess(&self) -> &parse::ParseSess;
28+
}
29+
30+
impl FakeExtCtxt for parse::ParseSess {
31+
fn call_site(&self) -> codemap::Span {
32+
codemap::Span {
33+
lo: codemap::BytePos(0),
34+
hi: codemap::BytePos(0),
35+
expn_id: codemap::NO_EXPANSION,
36+
}
37+
}
38+
fn cfg(&self) -> ast::CrateConfig { Vec::new() }
39+
fn ident_of(&self, st: &str) -> ast::Ident {
40+
parse::token::str_to_ident(st)
41+
}
42+
fn name_of(&self, st: &str) -> ast::Name {
43+
parse::token::intern(st)
44+
}
45+
fn parse_sess(&self) -> &parse::ParseSess { self }
46+
}
47+
48+
fn main() {
49+
let cx = parse::new_parse_sess();
50+
51+
assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23");
52+
53+
let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR unresolved name: `abcd`
54+
assert_eq!(pprust::expr_to_string(&*expr), "2 - $abcd + 7");
55+
}

src/test/parse-fail/qquote-1.rs

-70
This file was deleted.

0 commit comments

Comments
 (0)