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

Function test_extract_interface

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

Source from the content-addressed store, hash-verified

490
491 #[test]
492 fn test_extract_interface() {
493 let mut parser = GoParser::new();
494 let source = r#"
495package main
496
497type Repository interface {
498 Find(id string) (*Entity, error)
499 Save(entity *Entity) error
500}
501"#;
502 let entities = parser.extract(source, "repo.go");
503 let repo = entities.iter().find(|e| e.name == "Repository").unwrap();
504 assert_eq!(repo.kind, EntityKind::Interface);
505 assert!(repo.exported);
506 assert!(
507 repo.signature
508 .as_ref()
509 .unwrap()
510 .contains("type Repository interface"),
511 "Signature: {:?}",
512 repo.signature
513 );
514 }
515
516 #[test]
517 fn test_extract_method() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected