Skip to content

Commit 83cece4

Browse files
committed
Move tests to own file
1 parent ca48d15 commit 83cece4

File tree

2 files changed

+41
-42
lines changed

2 files changed

+41
-42
lines changed

src/rustdoc-json-types/lib.rs

+1-42
Original file line numberDiff line numberDiff line change
@@ -510,45 +510,4 @@ pub struct Static {
510510
}
511511

512512
#[cfg(test)]
513-
mod tests {
514-
use super::*;
515-
516-
#[test]
517-
fn test_struct_info_roundtrip() {
518-
let s = ItemEnum::Struct(Struct {
519-
struct_type: StructType::Plain,
520-
generics: Generics {
521-
params: vec![],
522-
where_predicates: vec![]
523-
},
524-
fields_stripped: false,
525-
fields: vec![],
526-
impls: vec![],
527-
});
528-
529-
let struct_json = serde_json::to_string(&s).unwrap();
530-
531-
let de_s = serde_json::from_str(&struct_json).unwrap();
532-
533-
assert_eq!(s, de_s);
534-
}
535-
536-
#[test]
537-
fn test_union_info_roundtrip() {
538-
let u = ItemEnum::Union(Union {
539-
generics: Generics {
540-
params: vec![],
541-
where_predicates: vec![]
542-
},
543-
fields_stripped: false,
544-
fields: vec![],
545-
impls: vec![],
546-
});
547-
548-
let union_json = serde_json::to_string(&u).unwrap();
549-
550-
let de_u = serde_json::from_str(&union_json).unwrap();
551-
552-
assert_eq!(u, de_u);
553-
}
554-
}
513+
mod tests;

src/rustdoc-json-types/tests.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
use super::*;
2+
3+
#[test]
4+
fn test_struct_info_roundtrip() {
5+
let s = ItemEnum::Struct(Struct {
6+
struct_type: StructType::Plain,
7+
generics: Generics {
8+
params: vec![],
9+
where_predicates: vec![]
10+
},
11+
fields_stripped: false,
12+
fields: vec![],
13+
impls: vec![],
14+
});
15+
16+
let struct_json = serde_json::to_string(&s).unwrap();
17+
18+
let de_s = serde_json::from_str(&struct_json).unwrap();
19+
20+
assert_eq!(s, de_s);
21+
}
22+
23+
#[test]
24+
fn test_union_info_roundtrip() {
25+
let u = ItemEnum::Union(Union {
26+
generics: Generics {
27+
params: vec![],
28+
where_predicates: vec![]
29+
},
30+
fields_stripped: false,
31+
fields: vec![],
32+
impls: vec![],
33+
});
34+
35+
let union_json = serde_json::to_string(&u).unwrap();
36+
37+
let de_u = serde_json::from_str(&union_json).unwrap();
38+
39+
assert_eq!(u, de_u);
40+
}

0 commit comments

Comments
 (0)