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

Function test_extract_namespace

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

Source from the content-addressed store, hash-verified

888
889 #[test]
890 fn test_extract_namespace() {
891 let mut parser = CppParser::new();
892 let source = r#"
893namespace utils {
894 int helper() {
895 return 42;
896 }
897}
898"#;
899 let entities = parser.extract(source, "utils.cpp");
900 let ns = entities.iter().find(|e| e.name == "utils").unwrap();
901 assert_eq!(ns.kind, EntityKind::Module);
902 assert!(
903 ns.signature.as_ref().unwrap().contains("namespace utils"),
904 "Signature: {:?}",
905 ns.signature
906 );
907
908 // Function inside namespace should be scoped
909 let helper = entities.iter().find(|e| e.name == "utils::helper").unwrap();
910 assert_eq!(helper.kind, EntityKind::Function);
911 }
912
913 #[test]
914 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