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

Function test_extract_struct

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

Source from the content-addressed store, hash-verified

700
701 #[test]
702 fn test_extract_struct() {
703 let mut parser = RustParser::new();
704 let source = r#"
705pub struct User {
706 pub name: String,
707 pub email: Option<String>,
708 age: u32,
709}
710"#;
711 let entities = parser.extract(source, "src/models.rs");
712 let user = entities.iter().find(|e| e.name == "User").unwrap();
713 assert_eq!(user.kind, EntityKind::Class);
714 assert!(user.exported);
715 assert!(
716 user.signature.as_ref().unwrap().contains("pub struct User"),
717 "Signature: {:?}",
718 user.signature
719 );
720 }
721
722 #[test]
723 fn test_extract_generic_struct() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected