Files
rust/crates/proc_macro_srv/src/tests/mod.rs

46 lines
856 B
Rust
Raw Normal View History

2020-04-10 01:43:47 +08:00
//! 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",
2020-05-10 06:22:26 +08:00
"1.0",
2020-07-01 18:08:45 +03:00
r"struct Foo {}",
2020-04-10 01:43:47 +08:00
include_str!("fixtures/test_serialize_proc_macro.txt"),
);
}
#[test]
fn test_derive_serialize_proc_macro_failed() {
assert_expand(
"serde_derive",
"Serialize",
2020-05-10 06:22:26 +08:00
"1.0",
2020-07-01 18:08:45 +03:00
r"struct {}",
2020-04-10 01:43:47 +08:00
r##"
SUBTREE $
IDENT compile_error 4294967295
PUNCH ! [alone] 4294967295
SUBTREE {} 4294967295
LITERAL "expected identifier" 4294967295
"##,
);
}
#[test]
fn test_derive_proc_macro_list() {
2020-05-10 06:22:26 +08:00
let res = list("serde_derive", "1.0").join("\n");
2020-04-10 01:43:47 +08:00
assert_eq_text!(
&res,
r#"Serialize [CustomDerive]
Deserialize [CustomDerive]"#
);
}