| 817 | |
| 818 | #[test] |
| 819 | fn test_extract_trait_impl() { |
| 820 | let mut parser = RustParser::new(); |
| 821 | let source = r#" |
| 822 | impl Display for User { |
| 823 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 824 | write!(f, "{}", self.name) |
| 825 | } |
| 826 | } |
| 827 | "#; |
| 828 | let entities = parser.extract(source, "src/models.rs"); |
| 829 | |
| 830 | // Should find the impl block |
| 831 | assert!( |
| 832 | entities.iter().any(|e| e.kind == EntityKind::Module), |
| 833 | "Should find impl block" |
| 834 | ); |
| 835 | |
| 836 | // Should find the fmt method |
| 837 | assert!( |
| 838 | entities |
| 839 | .iter() |
| 840 | .any(|e| e.name == "fmt" && e.kind == EntityKind::Method), |
| 841 | "Should find fmt method" |
| 842 | ); |
| 843 | } |
| 844 | |
| 845 | #[test] |
| 846 | fn test_extract_type_alias() { |