MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_extract_trait_impl

Function test_extract_trait_impl

atomic-semantic/src/parsers/rust.rs:819–843  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

817
818 #[test]
819 fn test_extract_trait_impl() {
820 let mut parser = RustParser::new();
821 let source = r#"
822impl 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() {

Callers

nothing calls this directly

Calls 1

extractMethod · 0.45

Tested by

no test coverage detected