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

Function test_extract_use

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

Source from the content-addressed store, hash-verified

917
918 #[test]
919 fn test_extract_use() {
920 let mut parser = RustParser::new();
921 let source = r#"
922use std::collections::HashMap;
923use crate::models::User;
924pub use self::auth::Token;
925"#;
926 let entities = parser.extract(source, "src/lib.rs");
927 let imports: Vec<_> = entities
928 .iter()
929 .filter(|e| e.kind == EntityKind::Import)
930 .collect();
931 assert!(
932 imports.len() >= 3,
933 "Should find 3 imports, got: {:?}",
934 imports.iter().map(|e| &e.name).collect::<Vec<_>>()
935 );
936 }
937
938 #[test]
939 fn test_empty_source() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected