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

Function test_extract_function

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

Source from the content-addressed store, hash-verified

810
811 #[test]
812 fn test_extract_function() {
813 let mut parser = CppParser::new();
814 let source = r#"
815int add(int a, int b) {
816 return a + b;
817}
818"#;
819 let entities = parser.extract(source, "math.cpp");
820 let add = entities.iter().find(|e| e.name == "add").unwrap();
821 assert_eq!(add.kind, EntityKind::Function);
822 assert!(
823 add.signature
824 .as_ref()
825 .unwrap()
826 .contains("int add(int a, int b)"),
827 "Signature: {:?}",
828 add.signature
829 );
830 }
831
832 #[test]
833 fn test_extract_void_function() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected