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

Function test_extract_trait_impl

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

Source from the content-addressed store, hash-verified

840
841 #[test]
842 fn test_extract_trait_impl() {
843 let mut parser = RustParser::new();
844 let source = r#"
845impl 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() {

Callers

nothing calls this directly

Calls 1

extractMethod · 0.45

Tested by

no test coverage detected