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