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

Function test_extract_function

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

Source from the content-addressed store, hash-verified

626
627 #[test]
628 fn test_extract_function() {
629 let mut parser = RustParser::new();
630 let source = r#"
631pub fn greet(name: &str) -> String {
632 format!("Hello, {}!", name)
633}
634"#;
635 let entities = parser.extract(source, "src/lib.rs");
636 assert!(!entities.is_empty());
637 let greet = entities.iter().find(|e| e.name == "greet").unwrap();
638 assert_eq!(greet.kind, EntityKind::Function);
639 assert!(greet.exported);
640 assert!(greet.signature.as_ref().unwrap().contains("pub fn greet"));
641 }
642
643 #[test]
644 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