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

Function test_extract_inline_method

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

Source from the content-addressed store, hash-verified

1012
1013 #[test]
1014 fn test_extract_inline_method() {
1015 let mut parser = CppParser::new();
1016 let source = r#"
1017class Calculator {
1018public:
1019 int add(int a, int b) {
1020 return a + b;
1021 }
1022};
1023"#;
1024 let entities = parser.extract(source, "calc.cpp");
1025
1026 let calc = entities.iter().find(|e| e.name == "Calculator").unwrap();
1027 assert_eq!(calc.kind, EntityKind::Class);
1028
1029 let add = entities
1030 .iter()
1031 .find(|e| e.name == "Calculator::add")
1032 .unwrap();
1033 assert_eq!(add.kind, EntityKind::Method);
1034 }
1035
1036 #[test]
1037 fn test_extract_type_alias() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected