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

Function test_extract_const

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

Source from the content-addressed store, hash-verified

569
570 #[test]
571 fn test_extract_const() {
572 let mut parser = GoParser::new();
573 let source = r#"
574package main
575
576const MaxRetries = 3
577
578const (
579 StatusActive = "active"
580 StatusInactive = "inactive"
581)
582"#;
583 let entities = parser.extract(source, "config.go");
584
585 let max = entities.iter().find(|e| e.name == "MaxRetries");
586 assert!(max.is_some(), "Should find MaxRetries");
587 assert_eq!(max.unwrap().kind, EntityKind::Const);
588 assert!(max.unwrap().exported);
589
590 let active = entities.iter().find(|e| e.name == "StatusActive");
591 assert!(active.is_some(), "Should find StatusActive in const group");
592 assert_eq!(active.unwrap().kind, EntityKind::Const);
593
594 let inactive = entities.iter().find(|e| e.name == "StatusInactive");
595 assert!(
596 inactive.is_some(),
597 "Should find StatusInactive in const group"
598 );
599 }
600
601 #[test]
602 fn test_extract_var() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected