From 3b6b779e88e6cf9a7634b4d6b4a81f3019a28cba Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Mon, 3 Apr 2017 05:46:59 +0000 Subject: [PATCH] Add test. --- .../auxiliary/type_macros_example.rs | 23 ++++++++++++++++ .../proc-macro/type_macros.rs | 26 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/test/run-pass-fulldeps/proc-macro/auxiliary/type_macros_example.rs create mode 100644 src/test/run-pass-fulldeps/proc-macro/type_macros.rs diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/type_macros_example.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/type_macros_example.rs new file mode 100644 index 0000000000000..ca7e10e11d1ff --- /dev/null +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/type_macros_example.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Example)] +pub fn example(input: TokenStream) -> TokenStream { + assert!(input.to_string().contains("i32")); + "".parse().unwrap() +} diff --git a/src/test/run-pass-fulldeps/proc-macro/type_macros.rs b/src/test/run-pass-fulldeps/proc-macro/type_macros.rs new file mode 100644 index 0000000000000..a9c6e273e06c6 --- /dev/null +++ b/src/test/run-pass-fulldeps/proc-macro/type_macros.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:type_macros_example.rs + +#![feature(proc_macro)] + +extern crate type_macros_example; + +use type_macros_example::Example; + +macro_rules! m { () => { i32 } } + +#[derive(Example)] +struct S { + x: m!(), +} + +fn main() {}