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

Function test_extract_struct

atomic-semantic/src/parsers/go.rs:466–489  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

464
465 #[test]
466 fn test_extract_struct() {
467 let mut parser = GoParser::new();
468 let source = r#"
469package main
470
471type User struct {
472 Name string
473 Email string
474 Age int
475}
476"#;
477 let entities = parser.extract(source, "models.go");
478 let user = entities.iter().find(|e| e.name == "User").unwrap();
479 assert_eq!(user.kind, EntityKind::Class);
480 assert!(user.exported);
481 assert!(
482 user.signature
483 .as_ref()
484 .unwrap()
485 .contains("type User struct"),
486 "Signature: {:?}",
487 user.signature
488 );
489 }
490
491 #[test]
492 fn test_extract_interface() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected