| 569 | |
| 570 | #[test] |
| 571 | fn test_extract_const() { |
| 572 | let mut parser = GoParser::new(); |
| 573 | let source = r#" |
| 574 | package main |
| 575 | |
| 576 | const MaxRetries = 3 |
| 577 | |
| 578 | const ( |
| 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() { |