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

Function test_extract_namespace

atomic-semantic/src/parsers/cpp.rs:913–934  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

911
912 #[test]
913 fn test_extract_namespace() {
914 let mut parser = CppParser::new();
915 let source = r#"
916namespace utils {
917 int helper() {
918 return 42;
919 }
920}
921"#;
922 let entities = parser.extract(source, "utils.cpp");
923 let ns = entities.iter().find(|e| e.name == "utils").unwrap();
924 assert_eq!(ns.kind, EntityKind::Module);
925 assert!(
926 ns.signature.as_ref().unwrap().contains("namespace utils"),
927 "Signature: {:?}",
928 ns.signature
929 );
930
931 // Function inside namespace should be scoped
932 let helper = entities.iter().find(|e| e.name == "utils::helper").unwrap();
933 assert_eq!(helper.kind, EntityKind::Function);
934 }
935
936 #[test]
937 fn test_extract_enum() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected