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

Function test_extract_const

atomic-semantic/src/parsers/rust.rs:888–904  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

886
887 #[test]
888 fn test_extract_const() {
889 let mut parser = RustParser::new();
890 let source = r#"
891pub const MAX_RETRIES: u32 = 3;
892const INTERNAL_LIMIT: usize = 100;
893"#;
894 let entities = parser.extract(source, "src/config.rs");
895
896 let max = entities.iter().find(|e| e.name == "MAX_RETRIES");
897 assert!(max.is_some(), "Should find MAX_RETRIES");
898 assert_eq!(max.unwrap().kind, EntityKind::Const);
899 assert!(max.unwrap().exported);
900
901 let internal = entities.iter().find(|e| e.name == "INTERNAL_LIMIT");
902 assert!(internal.is_some(), "Should find INTERNAL_LIMIT");
903 assert!(!internal.unwrap().exported);
904 }
905
906 #[test]
907 fn test_extract_static() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected