about summary refs log tree commit diff
path: root/src/test/run-make
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2018-03-20 22:19:52 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-30 06:15:20 +0200
commitfcca22cb4072097fc2cd1ae78ff84c7d59aacda2 (patch)
treeff9a90706e343251ea3b7e3f86e46f3401d089f1 /src/test/run-make
parentd3ab4a74efad266155fcd402c8d159af9e443e3d (diff)
downloadrust-fcca22cb4072097fc2cd1ae78ff84c7d59aacda2.tar.gz
rust-fcca22cb4072097fc2cd1ae78ff84c7d59aacda2.zip
tests: move all proc_macro tests from -fulldeps.
Diffstat (limited to 'src/test/run-make')
-rw-r--r--src/test/run-make/rustc-macro-dep-files/Makefile6
-rw-r--r--src/test/run-make/rustc-macro-dep-files/bar.rs19
-rw-r--r--src/test/run-make/rustc-macro-dep-files/foo.rs22
3 files changed, 47 insertions, 0 deletions
diff --git a/src/test/run-make/rustc-macro-dep-files/Makefile b/src/test/run-make/rustc-macro-dep-files/Makefile
new file mode 100644
index 00000000000..68405851f9d
--- /dev/null
+++ b/src/test/run-make/rustc-macro-dep-files/Makefile
@@ -0,0 +1,6 @@
+-include ../../run-make-fulldeps/tools.mk
+
+all:
+	$(RUSTC) foo.rs
+	$(RUSTC) bar.rs --emit dep-info
+	$(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d
diff --git a/src/test/run-make/rustc-macro-dep-files/bar.rs b/src/test/run-make/rustc-macro-dep-files/bar.rs
new file mode 100644
index 00000000000..03330c3d170
--- /dev/null
+++ b/src/test/run-make/rustc-macro-dep-files/bar.rs
@@ -0,0 +1,19 @@
+// 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.
+
+#[macro_use]
+extern crate foo;
+
+#[derive(A)]
+struct A;
+
+fn main() {
+    let _b = B;
+}
diff --git a/src/test/run-make/rustc-macro-dep-files/foo.rs b/src/test/run-make/rustc-macro-dep-files/foo.rs
new file mode 100644
index 00000000000..2f2524f6ef1
--- /dev/null
+++ b/src/test/run-make/rustc-macro-dep-files/foo.rs
@@ -0,0 +1,22 @@
+// 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.
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(A)]
+pub fn derive(input: TokenStream) -> TokenStream {
+    let input = input.to_string();
+    assert!(input.contains("struct A;"));
+    "struct B;".parse().unwrap()
+}