| 747 | |
| 748 | #[test] |
| 749 | fn test_extract_trait_methods() { |
| 750 | let mut parser = RustParser::new(); |
| 751 | let source = r#" |
| 752 | pub trait Service { |
| 753 | fn start(&self); |
| 754 | fn stop(&mut self); |
| 755 | } |
| 756 | "#; |
| 757 | let entities = parser.extract(source, "src/traits.rs"); |
| 758 | assert!( |
| 759 | entities.iter().any(|e| e.name == "Service"), |
| 760 | "Should find Service trait, got: {:?}", |
| 761 | entities.iter().map(|e| &e.name).collect::<Vec<_>>() |
| 762 | ); |
| 763 | // Trait method signatures may or may not be extracted depending on |
| 764 | // tree-sitter's representation (they might be function_signature_item |
| 765 | // rather than function_item). At minimum, the trait itself should be found. |
| 766 | } |
| 767 | |
| 768 | #[test] |
| 769 | fn test_extract_impl_block() { |