aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_srv/src/tests/mod.rs
diff options
context:
space:
mode:
authorPavan Kumar Sunkara <[email protected]>2020-08-13 01:57:26 +0100
committerPavan Kumar Sunkara <[email protected]>2020-08-13 02:18:19 +0100
commit349e6c62ada1fa45a8b80edb877b5e7c9d0c306d (patch)
treec08cb7cd48089c1c7316ff2570de02df76e9d9ef /crates/proc_macro_srv/src/tests/mod.rs
parentf277ec27ac024992e8b8834c68e16b31c983be1b (diff)
Rename ra_proc_macro_srv -> proc_macro_srv
Diffstat (limited to 'crates/proc_macro_srv/src/tests/mod.rs')
-rw-r--r--crates/proc_macro_srv/src/tests/mod.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/crates/proc_macro_srv/src/tests/mod.rs b/crates/proc_macro_srv/src/tests/mod.rs
new file mode 100644
index 000000000..8e6f28abd
--- /dev/null
+++ b/crates/proc_macro_srv/src/tests/mod.rs
@@ -0,0 +1,45 @@
1//! proc-macro tests
2
3#[macro_use]
4mod utils;
5use test_utils::assert_eq_text;
6use utils::*;
7
8#[test]
9fn test_derive_serialize_proc_macro() {
10 assert_expand(
11 "serde_derive",
12 "Serialize",
13 "1.0",
14 r"struct Foo {}",
15 include_str!("fixtures/test_serialize_proc_macro.txt"),
16 );
17}
18
19#[test]
20fn test_derive_serialize_proc_macro_failed() {
21 assert_expand(
22 "serde_derive",
23 "Serialize",
24 "1.0",
25 r"struct {}",
26 r##"
27SUBTREE $
28 IDENT compile_error 4294967295
29 PUNCH ! [alone] 4294967295
30 SUBTREE {} 4294967295
31 LITERAL "expected identifier" 4294967295
32"##,
33 );
34}
35
36#[test]
37fn test_derive_proc_macro_list() {
38 let res = list("serde_derive", "1.0").join("\n");
39
40 assert_eq_text!(
41 &res,
42 r#"Serialize [CustomDerive]
43Deserialize [CustomDerive]"#
44 );
45}