mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 330123: Testcase for renaming function with const parameter.
This commit is contained in:
parent
c18d5df1fd
commit
74d5616eb8
1 changed files with 21 additions and 0 deletions
|
@ -812,4 +812,25 @@ public class RenameFunctionTests extends RenameTests {
|
||||||
Change changes = getRefactorChanges(cpp, offset, "z"); //$NON-NLS-1$
|
Change changes = getRefactorChanges(cpp, offset, "z"); //$NON-NLS-1$
|
||||||
assertTotalChanges( 2, changes );
|
assertTotalChanges( 2, changes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug330123() throws Exception {
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
writer.write("class Foo{ \n"); //$NON-NLS-1$
|
||||||
|
writer.write(" void bar(const int param);\n"); //$NON-NLS-1$
|
||||||
|
writer.write("}; \n"); //$NON-NLS-1$
|
||||||
|
String header = writer.toString();
|
||||||
|
IFile h = importFile("Foo.h", header); //$NON-NLS-1$
|
||||||
|
writer = new StringWriter();
|
||||||
|
writer.write("#include \"Foo.h\" \n"); //$NON-NLS-1$
|
||||||
|
writer.write("void Foo::bar(const int param) {\n"); //$NON-NLS-1$
|
||||||
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
|
String source = writer.toString();
|
||||||
|
IFile cpp = importFile("Foo.cpp", source); //$NON-NLS-1$
|
||||||
|
int offset = header.indexOf("bar") ; //$NON-NLS-1$
|
||||||
|
Change changes = getRefactorChanges(h, offset, "ooga"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
assertTotalChanges(2, changes);
|
||||||
|
assertChange(changes, h, header.indexOf("bar"), 3, "ooga"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
assertChange(changes, cpp, source.indexOf("bar"), 3, "ooga"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue