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.
14 #![feature(rustc_private)]
15 #![plugin(proc_macro_plugin)]
18 extern crate syntax_pos;
20 use syntax::ast::{Ident, Name};
21 use syntax::parse::token::{self, Token, Lit};
22 use syntax::tokenstream::TokenTree;
25 let true_tok = token::Ident(Ident::from_str("true"));
26 assert!(quote!(true).eq_unspanned(&true_tok.into()));
28 // issue #35829, extended check to proc_macro.
29 let triple_dot_tok = Token::DotDotDot;
30 assert!(quote!(...).eq_unspanned(&triple_dot_tok.into()));
32 let byte_str_tok = Token::Literal(Lit::ByteStr(Name::intern("one")), None);
33 assert!(quote!(b"one").eq_unspanned(&byte_str_tok.into()));
35 let byte_str_raw_tok = Token::Literal(Lit::ByteStrRaw(Name::intern("#\"two\"#"), 3), None);
36 assert!(quote!(br###"#"two"#"###).eq_unspanned(&byte_str_raw_tok.into()));
38 let str_raw_tok = Token::Literal(Lit::StrRaw(Name::intern("#\"three\"#"), 2), None);
39 assert!(quote!(r##"#"three"#"##).eq_unspanned(&str_raw_tok.into()));