1 // Copyright 2012-2013-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.
13 // This test is brittle!
14 // ignore-pretty - the pretty tests lose path information, breaking include!
18 pub fn where_am_i() -> String {
19 (module_path!()).to_string()
24 macro_rules! indirect_line { () => ( line!() ) }
27 assert_eq!(line!(), 27);
28 assert_eq!(column!(), 4);
29 assert_eq!(indirect_line!(), 29);
30 assert!((file!().ends_with("syntax-extension-source-utils.rs")));
31 assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string());
32 assert!(include!("syntax-extension-source-utils-files/includeme.\
33 fragment").to_string()
34 == "victory robot 6".to_string());
37 include_str!("syntax-extension-source-utils-files/includeme.\
38 fragment").to_string()
39 .starts_with("/* this is for "));
41 include_bytes!("syntax-extension-source-utils-files/includeme.fragment")
42 [1] == (42 as u8)); // '*'
43 // The Windows tests are wrapped in an extra module for some reason
44 assert!((m1::m2::where_am_i().ends_with("m1::m2")));
46 assert_eq!((46, "( 2 * 3 ) + 5"), (line!(), stringify!((2*3) + 5)));