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;
2
2
3
3
use std:: path:: PathBuf ;
4
4
5
- fn run_mode ( mode : & ' static str ) {
6
-
5
+ fn run_mode ( mode : & ' static str , custom_dir : Option < & ' static str > ) {
7
6
let mut config = compiletest:: Config :: default ( ) . tempdir ( ) ;
8
7
let cfg_mode = mode. parse ( ) . expect ( "Invalid mode" ) ;
9
8
10
9
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) ) ;
12
13
config. target_rustcflags = Some ( "-L target/debug -L target/debug/deps" . to_string ( ) ) ;
13
14
config. clean_rmeta ( ) ;
14
15
@@ -17,10 +18,12 @@ fn run_mode(mode: &'static str) {
17
18
18
19
#[ test]
19
20
fn 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 ) ;
23
24
24
25
#[ cfg( not( feature = "stable" ) ) ]
25
- run_mode ( "pretty" ) ;
26
+ run_mode ( "pretty" , None ) ;
27
+ #[ cfg( not( feature = "stable" ) ) ]
28
+ run_mode ( "ui" , Some ( "nightly" ) ) ;
26
29
}
You can’t perform that action at this time.
0 commit comments