about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-11-08 04:06:40 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-11-10 11:21:23 +0000
commit67eeb0a72081ae7db45a07de55fd2cb77b2ebee1 (patch)
tree50d83c03ab78649edca960936d4a60815de10931 /src
parent11195676a03cf08b13c41684de328869ac345ff8 (diff)
downloadrust-67eeb0a72081ae7db45a07de55fd2cb77b2ebee1.tar.gz
rust-67eeb0a72081ae7db45a07de55fd2cb77b2ebee1.zip
Add regression test.
Diffstat (limited to 'src')
-rw-r--r--src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs24
-rw-r--r--src/test/run-pass-fulldeps/proc-macro/crate-var.rs27
2 files changed, 51 insertions, 0 deletions
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs
new file mode 100644
index 00000000000..969ed91f595
--- /dev/null
+++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs
@@ -0,0 +1,24 @@
+// Copyright 2016 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+#![feature(proc_macro)]
+#![feature(proc_macro_lib)]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Double)]
+pub fn derive(input: TokenStream) -> TokenStream {
+    format!("mod foo {{ {} }}", input.to_string()).parse().unwrap()
+}
diff --git a/src/test/run-pass-fulldeps/proc-macro/crate-var.rs b/src/test/run-pass-fulldeps/proc-macro/crate-var.rs
new file mode 100644
index 00000000000..d19b49ab18c
--- /dev/null
+++ b/src/test/run-pass-fulldeps/proc-macro/crate-var.rs
@@ -0,0 +1,27 @@
+// Copyright 2016 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:double.rs
+
+#![feature(proc_macro)]
+#![allow(unused)]
+
+#[macro_use]
+extern crate double;
+
+struct Foo;
+
+macro_rules! m { () => {
+    #[derive(Double)]
+    struct Bar($crate::Foo);
+} }
+m!();
+
+fn main() {}