File tree Expand file tree Collapse file tree 3 files changed +35
-7
lines changed
Expand file tree Collapse file tree 3 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 1+ // no-prefer-dynamic
2+
3+ #![ crate_type = "proc-macro" ]
4+
5+ extern crate proc_macro;
6+
7+ use proc_macro:: { TokenStream } ;
8+
9+ #[ proc_macro]
10+ pub fn macro_test ( input_stream : TokenStream ) -> TokenStream {
11+ TokenStream :: new ( )
12+ }
Original file line number Diff line number Diff line change 1+ // run-pass
2+ // aux-build:simple_proc_macro.rs
3+
4+ #![ feature( proc_macro_hygiene) ]
5+
6+ extern crate simple_proc_macro;
7+ use simple_proc_macro:: macro_test;
8+
9+ fn main ( ) {
10+ println ! ( "hi" ) ;
11+ macro_test ! ( 2 ) ;
12+ }
13+
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ extern crate compiletest_rs as compiletest;
22
33use std:: path:: PathBuf ;
44
5- fn run_mode ( mode : & ' static str ) {
6-
5+ fn run_mode ( mode : & ' static str , custom_dir : Option < & ' static str > ) {
76 let mut config = compiletest:: Config :: default ( ) . tempdir ( ) ;
87 let cfg_mode = mode. parse ( ) . expect ( "Invalid mode" ) ;
98
109 config. mode = cfg_mode;
11- config. src_base = PathBuf :: from ( format ! ( "tests/{}" , mode) ) ;
10+
11+ let dir = custom_dir. unwrap_or ( mode) ;
12+ config. src_base = PathBuf :: from ( format ! ( "tests/{}" , dir) ) ;
1213 config. target_rustcflags = Some ( "-L target/debug -L target/debug/deps" . to_string ( ) ) ;
1314 config. clean_rmeta ( ) ;
1415
@@ -17,10 +18,12 @@ fn run_mode(mode: &'static str) {
1718
1819#[ test]
1920fn compile_test ( ) {
20- run_mode ( "compile-fail" ) ;
21- run_mode ( "run-pass" ) ;
22- run_mode ( "ui" ) ;
21+ run_mode ( "compile-fail" , None ) ;
22+ run_mode ( "run-pass" , None ) ;
23+ run_mode ( "ui" , None ) ;
2324
2425 #[ cfg( not( feature = "stable" ) ) ]
25- run_mode ( "pretty" ) ;
26+ run_mode ( "pretty" , None ) ;
27+ #[ cfg( not( feature = "stable" ) ) ]
28+ run_mode ( "ui" , Some ( "nightly" ) ) ;
2629}
You can’t perform that action at this time.
0 commit comments