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

Function test_extract_const

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

Source from the content-addressed store, hash-verified

863
864 #[test]
865 fn test_extract_const() {
866 let mut parser = RustParser::new();
867 let source = r#"
868pub const MAX_RETRIES: u32 = 3;
869const INTERNAL_LIMIT: usize = 100;
870"#;
871 let entities = parser.extract(source, "src/config.rs");
872
873 let max = entities.iter().find(|e| e.name == "MAX_RETRIES");
874 assert!(max.is_some(), "Should find MAX_RETRIES");
875 assert_eq!(max.unwrap().kind, EntityKind::Const);
876 assert!(max.unwrap().exported);
877
878 let internal = entities.iter().find(|e| e.name == "INTERNAL_LIMIT");
879 assert!(internal.is_some(), "Should find INTERNAL_LIMIT");
880 assert!(!internal.unwrap().exported);
881 }
882
883 #[test]
884 fn test_extract_static() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected