mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Add tests
This commit is contained in:
parent
e5698faf4c
commit
460ddde176
6 changed files with 305 additions and 0 deletions
47
crates/ra_proc_macro_srv/src/tests/mod.rs
Normal file
47
crates/ra_proc_macro_srv/src/tests/mod.rs
Normal file
|
@ -0,0 +1,47 @@
|
|||
//! proc-macro tests
|
||||
|
||||
#[macro_use]
|
||||
mod utils;
|
||||
use test_utils::assert_eq_text;
|
||||
use utils::*;
|
||||
|
||||
#[test]
|
||||
fn test_derive_serialize_proc_macro() {
|
||||
assert_expand(
|
||||
"serde_derive",
|
||||
"Serialize",
|
||||
"1.0.104",
|
||||
r##"struct Foo {}"##,
|
||||
include_str!("fixtures/test_serialize_proc_macro.txt"),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_derive_serialize_proc_macro_failed() {
|
||||
assert_expand(
|
||||
"serde_derive",
|
||||
"Serialize",
|
||||
"1.0.104",
|
||||
r##"
|
||||
struct {}
|
||||
"##,
|
||||
r##"
|
||||
SUBTREE $
|
||||
IDENT compile_error 4294967295
|
||||
PUNCH ! [alone] 4294967295
|
||||
SUBTREE {} 4294967295
|
||||
LITERAL "expected identifier" 4294967295
|
||||
"##,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_derive_proc_macro_list() {
|
||||
let res = list("serde_derive", "1.0.104").join("\n");
|
||||
|
||||
assert_eq_text!(
|
||||
&res,
|
||||
r#"Serialize [CustomDerive]
|
||||
Deserialize [CustomDerive]"#
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue