]> git.lizzy.rs Git - rust.git/blob - src/test/ui-fulldeps/mod_dir_path_canonicalized.rs
Make it build again
[rust.git] / src / test / ui-fulldeps / mod_dir_path_canonicalized.rs
1 // run-pass
2 // Testing that a librustc_ast can parse modules with canonicalized base path
3 // ignore-cross-compile
4
5 #![feature(rustc_private)]
6
7 extern crate syntax;
8 extern crate rustc_parse;
9 extern crate rustc_session;
10 extern crate rustc_span;
11
12 use rustc_parse::new_parser_from_file;
13 use rustc_session::parse::ParseSess;
14 use rustc_span::source_map::FilePathMapping;
15 use std::path::Path;
16
17 #[path = "mod_dir_simple/test.rs"]
18 mod gravy;
19
20 pub fn main() {
21     syntax::with_default_globals(|| parse());
22
23     assert_eq!(gravy::foo(), 10);
24 }
25
26 fn parse() {
27     let parse_session = ParseSess::new(FilePathMapping::empty());
28
29     let path = Path::new(file!());
30     let path = path.canonicalize().unwrap();
31     let mut parser = new_parser_from_file(&parse_session, &path);
32     let _ = parser.parse_crate_mod();
33 }