Skip to content

Commit

Permalink
Add a proc-macro UI test example to the test project
Browse files Browse the repository at this point in the history
Taken from work on rust-lang/rust-clippy#3741.

I think this is a useful test to have because it tests

* the `run-pass` header
* the `aux-build` header, building auxiliary files
* the `no-prefer-dynamic` header
* proc-macro crate interactions with all of the above
* running of UI tests that include auxiliary files

There's no tests for any of the above right now.
  • Loading branch information
phansch committed Apr 7, 2019
1 parent e2056b1 commit 0dce33e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test-project/tests/ui/auxiliary/simple_proc_macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::{TokenStream};

#[proc_macro]
pub fn macro_test(input_stream: TokenStream) -> TokenStream {
TokenStream::new()
}
12 changes: 12 additions & 0 deletions test-project/tests/ui/some-proc-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// run-pass
// aux-build:simple_proc_macro.rs

#![feature(proc_macro_hygiene)]

extern crate simple_proc_macro;
use simple_proc_macro::macro_test;

fn main() {
println!("hi");
macro_test!(2);
}

0 comments on commit 0dce33e

Please sign in to comment.