Skip to content

Commit 1cc7b51

Browse files
committed
qquote-2.rs -> run-fail/qquote.rs
Re-enables the test.
1 parent e22dd3e commit 1cc7b51

File tree

2 files changed

+57
-63
lines changed

2 files changed

+57
-63
lines changed

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

-63
This file was deleted.

src/test/run-fail/qquote.rs

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

0 commit comments

Comments
 (0)