Move tests to own file

This commit is contained in:
Rune Tynan 2021-03-04 19:08:06 -05:00
parent ca48d1566e
commit 83cece468e
No known key found for this signature in database
GPG Key ID: 7ECC932F8B2C731E
2 changed files with 41 additions and 42 deletions

View File

@ -510,45 +510,4 @@ pub struct Static {
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_struct_info_roundtrip() {
let s = ItemEnum::Struct(Struct {
struct_type: StructType::Plain,
generics: Generics {
params: vec![],
where_predicates: vec![]
},
fields_stripped: false,
fields: vec![],
impls: vec![],
});
let struct_json = serde_json::to_string(&s).unwrap();
let de_s = serde_json::from_str(&struct_json).unwrap();
assert_eq!(s, de_s);
}
#[test]
fn test_union_info_roundtrip() {
let u = ItemEnum::Union(Union {
generics: Generics {
params: vec![],
where_predicates: vec![]
},
fields_stripped: false,
fields: vec![],
impls: vec![],
});
let union_json = serde_json::to_string(&u).unwrap();
let de_u = serde_json::from_str(&union_json).unwrap();
assert_eq!(u, de_u);
}
}
mod tests;

View File

@ -0,0 +1,40 @@
use super::*;
#[test]
fn test_struct_info_roundtrip() {
let s = ItemEnum::Struct(Struct {
struct_type: StructType::Plain,
generics: Generics {
params: vec![],
where_predicates: vec![]
},
fields_stripped: false,
fields: vec![],
impls: vec![],
});
let struct_json = serde_json::to_string(&s).unwrap();
let de_s = serde_json::from_str(&struct_json).unwrap();
assert_eq!(s, de_s);
}
#[test]
fn test_union_info_roundtrip() {
let u = ItemEnum::Union(Union {
generics: Generics {
params: vec![],
where_predicates: vec![]
},
fields_stripped: false,
fields: vec![],
impls: vec![],
});
let union_json = serde_json::to_string(&u).unwrap();
let de_u = serde_json::from_str(&union_json).unwrap();
assert_eq!(u, de_u);
}