Skip to content

Commit 39441bb

Browse files
committed
Make a ui test to take the role of libproc_macro #[test] tests
1 parent 3e827cc commit 39441bb

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
4+
#![crate_type = "proc-macro"]
5+
#![crate_name = "proc_macro_api_tests"]
6+
#![deny(dead_code)] // catch if a test function is never called
7+
8+
extern crate proc_macro;
9+
10+
use proc_macro::TokenStream;
11+
12+
#[proc_macro]
13+
pub fn run(input: TokenStream) -> TokenStream {
14+
assert!(input.is_empty());
15+
TokenStream::new()
16+
}

src/test/ui/proc-macro/test.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
// aux-build:api/mod.rs
3+
4+
//! This is for everything that *would* be a #[test] inside of libproc_macro,
5+
//! except for the fact that proc_macro objects are not capable of existing
6+
//! inside of an ordinary Rust test execution, only inside a macro.
7+
8+
extern crate proc_macro_api_tests;
9+
10+
proc_macro_api_tests::run!();
11+
12+
fn main() {}

0 commit comments

Comments
 (0)