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

Function test_extract_async_function

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

Source from the content-addressed store, hash-verified

656
657 #[test]
658 fn test_extract_async_function() {
659 let mut parser = RustParser::new();
660 let source = r#"
661pub async fn fetch_data(url: &str) -> Result<String, Error> {
662 Ok("data".to_string())
663}
664"#;
665 let entities = parser.extract(source, "src/client.rs");
666 let fetch = entities.iter().find(|e| e.name == "fetch_data").unwrap();
667 assert_eq!(fetch.kind, EntityKind::Function);
668 assert!(fetch.exported);
669 // Note: whether "async" appears in the signature depends on tree-sitter's
670 // Rust grammar version. The function should be found regardless.
671 assert!(
672 fetch.signature.as_ref().unwrap().contains("fetch_data"),
673 "Signature should contain function name: {:?}",
674 fetch.signature
675 );
676 }
677
678 #[test]
679 fn test_extract_struct() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected