()
| 721 | |
| 722 | #[test] |
| 723 | fn test_extract_generic_struct() { |
| 724 | let mut parser = RustParser::new(); |
| 725 | let source = r#" |
| 726 | pub struct Cache<K, V> { |
| 727 | entries: HashMap<K, V>, |
| 728 | capacity: usize, |
| 729 | } |
| 730 | "#; |
| 731 | let entities = parser.extract(source, "src/cache.rs"); |
| 732 | let cache = entities.iter().find(|e| e.name == "Cache").unwrap(); |
| 733 | assert!( |
| 734 | cache.signature.as_ref().unwrap().contains("<K, V>"), |
| 735 | "Should include generics: {:?}", |
| 736 | cache.signature |
| 737 | ); |
| 738 | } |
| 739 | |
| 740 | #[test] |
| 741 | fn test_extract_enum() { |