diff options
Diffstat (limited to 'crates/ra_proc_macro_srv')
-rw-r--r-- | crates/ra_proc_macro_srv/Cargo.toml | 5 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt | 28 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/tests/mod.rs | 6 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/tests/utils.rs | 7 |
4 files changed, 20 insertions, 26 deletions
diff --git a/crates/ra_proc_macro_srv/Cargo.toml b/crates/ra_proc_macro_srv/Cargo.toml index ac2d156dc..582102945 100644 --- a/crates/ra_proc_macro_srv/Cargo.toml +++ b/crates/ra_proc_macro_srv/Cargo.toml | |||
@@ -18,7 +18,8 @@ memmap = "0.7" | |||
18 | test_utils = { path = "../test_utils" } | 18 | test_utils = { path = "../test_utils" } |
19 | 19 | ||
20 | [dev-dependencies] | 20 | [dev-dependencies] |
21 | cargo_metadata = "0.9.1" | 21 | cargo_metadata = "0.10.0" |
22 | difference = "2.0.0" | 22 | difference = "2.0.0" |
23 | # used as proc macro test target | 23 | # used as proc macro test target |
24 | serde_derive = "=1.0.104" | 24 | serde_derive = "1.0.106" |
25 | ra_toolchain = { path = "../ra_toolchain" } | ||
diff --git a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt index 1f5d940fa..bc010cfe9 100644 --- a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt +++ b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt | |||
@@ -1,6 +1,11 @@ | |||
1 | SUBTREE $ | 1 | SUBTREE $ |
2 | PUNCH # [alone] 4294967295 | 2 | PUNCH # [alone] 4294967295 |
3 | SUBTREE [] 4294967295 | 3 | SUBTREE [] 4294967295 |
4 | IDENT doc 4294967295 | ||
5 | SUBTREE () 4294967295 | ||
6 | IDENT hidden 4294967295 | ||
7 | PUNCH # [alone] 4294967295 | ||
8 | SUBTREE [] 4294967295 | ||
4 | IDENT allow 4294967295 | 9 | IDENT allow 4294967295 |
5 | SUBTREE () 4294967295 | 10 | SUBTREE () 4294967295 |
6 | IDENT non_upper_case_globals 4294967295 | 11 | IDENT non_upper_case_globals 4294967295 |
@@ -18,23 +23,12 @@ SUBTREE $ | |||
18 | SUBTREE [] 4294967295 | 23 | SUBTREE [] 4294967295 |
19 | IDENT allow 4294967295 | 24 | IDENT allow 4294967295 |
20 | SUBTREE () 4294967295 | 25 | SUBTREE () 4294967295 |
21 | IDENT unknown_lints 4294967295 | ||
22 | PUNCH # [alone] 4294967295 | ||
23 | SUBTREE [] 4294967295 | ||
24 | IDENT cfg_attr 4294967295 | ||
25 | SUBTREE () 4294967295 | ||
26 | IDENT feature 4294967295 | ||
27 | PUNCH = [alone] 4294967295 | ||
28 | LITERAL "cargo-clippy" 0 | ||
29 | PUNCH , [alone] 4294967295 | ||
30 | IDENT allow 4294967295 | ||
31 | SUBTREE () 4294967295 | ||
32 | IDENT useless_attribute 4294967295 | ||
33 | PUNCH # [alone] 4294967295 | ||
34 | SUBTREE [] 4294967295 | ||
35 | IDENT allow 4294967295 | ||
36 | SUBTREE () 4294967295 | ||
37 | IDENT rust_2018_idioms 4294967295 | 26 | IDENT rust_2018_idioms 4294967295 |
27 | PUNCH , [alone] 4294967295 | ||
28 | IDENT clippy 4294967295 | ||
29 | PUNCH : [joint] 4294967295 | ||
30 | PUNCH : [alone] 4294967295 | ||
31 | IDENT useless_attribute 4294967295 | ||
38 | IDENT extern 4294967295 | 32 | IDENT extern 4294967295 |
39 | IDENT crate 4294967295 | 33 | IDENT crate 4294967295 |
40 | IDENT serde 4294967295 | 34 | IDENT serde 4294967295 |
@@ -184,4 +178,4 @@ SUBTREE $ | |||
184 | IDENT end 4294967295 | 178 | IDENT end 4294967295 |
185 | SUBTREE () 4294967295 | 179 | SUBTREE () 4294967295 |
186 | IDENT __serde_state 4294967295 | 180 | IDENT __serde_state 4294967295 |
187 | PUNCH ; [alone] 4294967295 \ No newline at end of file | 181 | PUNCH ; [alone] 4294967295 |
diff --git a/crates/ra_proc_macro_srv/src/tests/mod.rs b/crates/ra_proc_macro_srv/src/tests/mod.rs index 03f79bc5d..82cefbb29 100644 --- a/crates/ra_proc_macro_srv/src/tests/mod.rs +++ b/crates/ra_proc_macro_srv/src/tests/mod.rs | |||
@@ -10,7 +10,7 @@ fn test_derive_serialize_proc_macro() { | |||
10 | assert_expand( | 10 | assert_expand( |
11 | "serde_derive", | 11 | "serde_derive", |
12 | "Serialize", | 12 | "Serialize", |
13 | "1.0.104", | 13 | "1.0", |
14 | r##"struct Foo {}"##, | 14 | r##"struct Foo {}"##, |
15 | include_str!("fixtures/test_serialize_proc_macro.txt"), | 15 | include_str!("fixtures/test_serialize_proc_macro.txt"), |
16 | ); | 16 | ); |
@@ -21,7 +21,7 @@ fn test_derive_serialize_proc_macro_failed() { | |||
21 | assert_expand( | 21 | assert_expand( |
22 | "serde_derive", | 22 | "serde_derive", |
23 | "Serialize", | 23 | "Serialize", |
24 | "1.0.104", | 24 | "1.0", |
25 | r##" | 25 | r##" |
26 | struct {} | 26 | struct {} |
27 | "##, | 27 | "##, |
@@ -37,7 +37,7 @@ SUBTREE $ | |||
37 | 37 | ||
38 | #[test] | 38 | #[test] |
39 | fn test_derive_proc_macro_list() { | 39 | fn test_derive_proc_macro_list() { |
40 | let res = list("serde_derive", "1.0.104").join("\n"); | 40 | let res = list("serde_derive", "1.0").join("\n"); |
41 | 41 | ||
42 | assert_eq_text!( | 42 | assert_eq_text!( |
43 | &res, | 43 | &res, |
diff --git a/crates/ra_proc_macro_srv/src/tests/utils.rs b/crates/ra_proc_macro_srv/src/tests/utils.rs index 646a427c5..8d85f2d8a 100644 --- a/crates/ra_proc_macro_srv/src/tests/utils.rs +++ b/crates/ra_proc_macro_srv/src/tests/utils.rs | |||
@@ -2,24 +2,23 @@ | |||
2 | 2 | ||
3 | use crate::dylib; | 3 | use crate::dylib; |
4 | use crate::ProcMacroSrv; | 4 | use crate::ProcMacroSrv; |
5 | pub use difference::Changeset as __Changeset; | ||
6 | use ra_proc_macro::ListMacrosTask; | 5 | use ra_proc_macro::ListMacrosTask; |
7 | use std::str::FromStr; | 6 | use std::str::FromStr; |
8 | use test_utils::assert_eq_text; | 7 | use test_utils::assert_eq_text; |
9 | 8 | ||
10 | mod fixtures { | 9 | mod fixtures { |
11 | use cargo_metadata::{parse_messages, Message}; | 10 | use cargo_metadata::Message; |
12 | use std::process::Command; | 11 | use std::process::Command; |
13 | 12 | ||
14 | // Use current project metadata to get the proc-macro dylib path | 13 | // Use current project metadata to get the proc-macro dylib path |
15 | pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf { | 14 | pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf { |
16 | let command = Command::new("cargo") | 15 | let command = Command::new(ra_toolchain::cargo()) |
17 | .args(&["check", "--message-format", "json"]) | 16 | .args(&["check", "--message-format", "json"]) |
18 | .output() | 17 | .output() |
19 | .unwrap() | 18 | .unwrap() |
20 | .stdout; | 19 | .stdout; |
21 | 20 | ||
22 | for message in parse_messages(command.as_slice()) { | 21 | for message in Message::parse_stream(command.as_slice()) { |
23 | match message.unwrap() { | 22 | match message.unwrap() { |
24 | Message::CompilerArtifact(artifact) => { | 23 | Message::CompilerArtifact(artifact) => { |
25 | if artifact.target.kind.contains(&"proc-macro".to_string()) { | 24 | if artifact.target.kind.contains(&"proc-macro".to_string()) { |