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

Function test_extract_struct

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

Source from the content-addressed store, hash-verified

677
678 #[test]
679 fn test_extract_struct() {
680 let mut parser = RustParser::new();
681 let source = r#"
682pub struct User {
683 pub name: String,
684 pub email: Option<String>,
685 age: u32,
686}
687"#;
688 let entities = parser.extract(source, "src/models.rs");
689 let user = entities.iter().find(|e| e.name == "User").unwrap();
690 assert_eq!(user.kind, EntityKind::Class);
691 assert!(user.exported);
692 assert!(
693 user.signature.as_ref().unwrap().contains("pub struct User"),
694 "Signature: {:?}",
695 user.signature
696 );
697 }
698
699 #[test]
700 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