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

Function test_extract_function

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

Source from the content-addressed store, hash-verified

649
650 #[test]
651 fn test_extract_function() {
652 let mut parser = RustParser::new();
653 let source = r#"
654pub fn greet(name: &str) -> String {
655 format!("Hello, {}!", name)
656}
657"#;
658 let entities = parser.extract(source, "src/lib.rs");
659 assert!(!entities.is_empty());
660 let greet = entities.iter().find(|e| e.name == "greet").unwrap();
661 assert_eq!(greet.kind, EntityKind::Function);
662 assert!(greet.exported);
663 assert!(greet.signature.as_ref().unwrap().contains("pub fn greet"));
664 }
665
666 #[test]
667 fn test_extract_private_function() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected