feat(parser): Implement C/C++ update_definition
This commit is contained in:
@@ -305,3 +305,23 @@ public:
|
||||
assert 'void normalMethod()' in sig2
|
||||
assert '{' not in sig2
|
||||
|
||||
def test_ast_parser_update_definition_cpp() -> None:
|
||||
"""Verify update_definition for C++ including scoped methods."""
|
||||
parser = ASTParser(language="cpp")
|
||||
code = """
|
||||
class MyClass {
|
||||
public:
|
||||
void myMethod() {
|
||||
int x = 1;
|
||||
}
|
||||
};
|
||||
"""
|
||||
new_method = """ void myMethod() {
|
||||
int y = 2;
|
||||
}"""
|
||||
updated = parser.update_definition(code, "MyClass::myMethod", new_method)
|
||||
assert 'void myMethod() {' in updated
|
||||
assert 'int y = 2;' in updated
|
||||
assert 'int x = 1;' not in updated
|
||||
assert 'class MyClass {' in updated
|
||||
|
||||
|
||||
Reference in New Issue
Block a user