Created
July 29, 2020 15:21
-
-
Save alexcrichton/d76bc7a77757a84b3b012e624cf25951 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tests/testsuite/features2.rs b/tests/testsuite/features2.rs | |
index 3790ab4be..98cce9a9e 100644 | |
--- a/tests/testsuite/features2.rs | |
+++ b/tests/testsuite/features2.rs | |
@@ -1749,3 +1749,85 @@ foo v0.1.0 ([..]/foo) | |
) | |
.run(); | |
} | |
+#[cargo_test] | |
+fn test_proc_macro() { | |
+ let p = project() | |
+ .file( | |
+ "Cargo.toml", | |
+ r#" | |
+ [package] | |
+ name = "runtime" | |
+ version = "0.1.0" | |
+ | |
+ [dependencies] | |
+ the-macro = { path = "the-macro", features = ['a'] } | |
+ | |
+ [build-dependencies] | |
+ shared = { path = "shared", features = ['b'] } | |
+ "#, | |
+ ) | |
+ .file("src/lib.rs", "") | |
+ .file( | |
+ "the-macro/Cargo.toml", | |
+ r#" | |
+ [package] | |
+ name = "the-macro" | |
+ version = "0.1.0" | |
+ | |
+ [lib] | |
+ proc-macro = true | |
+ test = false | |
+ | |
+ [dependencies] | |
+ the-macro-support = { path = "../the-macro-support" } | |
+ shared = { path = "../shared" } | |
+ | |
+ [dev-dependencies] | |
+ runtime = { path = ".." } | |
+ | |
+ [features] | |
+ a = [] | |
+ "#, | |
+ ) | |
+ .file( | |
+ "the-macro/src/lib.rs", | |
+ " | |
+ fn _test() { | |
+ the_macro_support::foo(shared::Foo); | |
+ } | |
+ ", | |
+ ) | |
+ .file( | |
+ "the-macro-support/Cargo.toml", | |
+ r#" | |
+ [package] | |
+ name = "the-macro-support" | |
+ version = "0.1.0" | |
+ | |
+ [dependencies] | |
+ shared = { path = "../shared" } | |
+ "#, | |
+ ) | |
+ .file( | |
+ "the-macro-support/src/lib.rs", | |
+ " | |
+ pub fn foo(_: shared::Foo) {} | |
+ ", | |
+ ) | |
+ .file( | |
+ "shared/Cargo.toml", | |
+ r#" | |
+ [package] | |
+ name = "shared" | |
+ version = "0.1.0" | |
+ | |
+ [features] | |
+ b = [] | |
+ "#, | |
+ ) | |
+ .file("shared/src/lib.rs", "pub struct Foo;") | |
+ .build(); | |
+ p.cargo("test -Zfeatures=all --manifest-path the-macro/Cargo.toml") | |
+ .masquerade_as_nightly_cargo() | |
+ .run(); | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment