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

Function test_extract_import

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

Source from the content-addressed store, hash-verified

632
633 #[test]
634 fn test_extract_import() {
635 let mut parser = GoParser::new();
636 let source = r#"
637package main
638
639import "fmt"
640
641import (
642 "net/http"
643 "encoding/json"
644)
645"#;
646 let entities = parser.extract(source, "main.go");
647 let imports: Vec<_> = entities
648 .iter()
649 .filter(|e| e.kind == EntityKind::Import)
650 .collect();
651 assert!(
652 imports.len() >= 2,
653 "Should find at least 2 import declarations, got: {:?}",
654 imports.iter().map(|e| &e.name).collect::<Vec<_>>()
655 );
656 }
657
658 #[test]
659 fn test_blank_identifier_skipped() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected