Add a proc_macro_test crate

This exports all 3 kinds of proc macros and is useful for testing
This commit is contained in:
Jonas Schievink 2020-08-15 00:19:47 +02:00
parent c2594daf29
commit cb816b1ea8
6 changed files with 51 additions and 3 deletions

View file

@ -35,7 +35,7 @@ SUBTREE $
#[test]
fn test_derive_proc_macro_list() {
let res = list("serde_derive", "1.0").join("\n");
let res = list("serde_derive", "1").join("\n");
assert_eq_text!(
&res,
@ -43,3 +43,16 @@ fn test_derive_proc_macro_list() {
Deserialize [CustomDerive]"#
);
}
/// Tests that we find and classify non-derive macros correctly.
#[test]
fn list_test_macros() {
let res = list("proc_macro_test", "0.0.0").join("\n");
assert_eq_text!(
&res,
r#"function_like_macro [FuncLike]
attribute_macro [Attr]
DummyTrait [CustomDerive]"#
);
}

View file

@ -13,7 +13,7 @@ mod fixtures {
// Use current project metadata to get the proc-macro dylib path
pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf {
let command = Command::new(toolchain::cargo())
.args(&["check", "--message-format", "json"])
.args(&["check", "--tests", "--message-format", "json"])
.output()
.unwrap()
.stdout;