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

Function test_extract_method_out_of_line

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

Source from the content-addressed store, hash-verified

1003
1004 #[test]
1005 fn test_extract_method_out_of_line() {
1006 let mut parser = CppParser::new();
1007 let source = r#"
1008class Server {
1009public:
1010 void start();
1011 int port();
1012};
1013
1014void Server::start() {
1015 running = true;
1016}
1017
1018int Server::port() {
1019 return port_;
1020}
1021"#;
1022 let entities = parser.extract(source, "server.cpp");
1023
1024 let start = entities.iter().find(|e| e.name == "Server::start").unwrap();
1025 assert_eq!(start.kind, EntityKind::Method);
1026 assert!(
1027 start.signature.as_ref().unwrap().contains("Server::start"),
1028 "Signature: {:?}",
1029 start.signature
1030 );
1031
1032 let port = entities.iter().find(|e| e.name == "Server::port").unwrap();
1033 assert_eq!(port.kind, EntityKind::Method);
1034 }
1035
1036 #[test]
1037 fn test_extract_inline_method() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected