diff options
| author | David Tolnay <dtolnay@gmail.com> | 2021-04-29 11:10:14 -0700 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2021-05-19 11:38:23 -0700 |
| commit | 39441bb2c1030884d0f1d200de0a65b146ba6b6d (patch) | |
| tree | dbff1129abe814b830c1e9a282ac8aa0d7b09c05 /src/test | |
| parent | 3e827cc21e0734edd26170e8d1481f0d66a1426b (diff) | |
| download | rust-39441bb2c1030884d0f1d200de0a65b146ba6b6d.tar.gz rust-39441bb2c1030884d0f1d200de0a65b146ba6b6d.zip | |
Make a ui test to take the role of libproc_macro #[test] tests
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/proc-macro/auxiliary/api/mod.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/test.rs | 12 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/proc-macro/auxiliary/api/mod.rs b/src/test/ui/proc-macro/auxiliary/api/mod.rs new file mode 100644 index 00000000000..72b02ad554e --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/api/mod.rs @@ -0,0 +1,16 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![crate_name = "proc_macro_api_tests"] +#![deny(dead_code)] // catch if a test function is never called + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro] +pub fn run(input: TokenStream) -> TokenStream { + assert!(input.is_empty()); + TokenStream::new() +} diff --git a/src/test/ui/proc-macro/test.rs b/src/test/ui/proc-macro/test.rs new file mode 100644 index 00000000000..c96aa73175f --- /dev/null +++ b/src/test/ui/proc-macro/test.rs @@ -0,0 +1,12 @@ +// check-pass +// aux-build:api/mod.rs + +//! This is for everything that *would* be a #[test] inside of libproc_macro, +//! except for the fact that proc_macro objects are not capable of existing +//! inside of an ordinary Rust test execution, only inside a macro. + +extern crate proc_macro_api_tests; + +proc_macro_api_tests::run!(); + +fn main() {} |
