| 840 | |
| 841 | #[test] |
| 842 | fn test_extract_trait_impl() { |
| 843 | let mut parser = RustParser::new(); |
| 844 | let source = r#" |
| 845 | impl Display for User { |
| 846 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 847 | write!(f, "{}", self.name) |
| 848 | } |
| 849 | } |
| 850 | "#; |
| 851 | let entities = parser.extract(source, "src/models.rs"); |
| 852 | |
| 853 | // Should find the impl block |
| 854 | assert!( |
| 855 | entities.iter().any(|e| e.kind == EntityKind::Module), |
| 856 | "Should find impl block" |
| 857 | ); |
| 858 | |
| 859 | // Should find the fmt method |
| 860 | assert!( |
| 861 | entities |
| 862 | .iter() |
| 863 | .any(|e| e.name == "fmt" && e.kind == EntityKind::Method), |
| 864 | "Should find fmt method" |
| 865 | ); |
| 866 | } |
| 867 | |
| 868 | #[test] |
| 869 | fn test_extract_type_alias() { |