- IDEA-96179 Replace with a camel case string and Preserve Case on converts the string to lower case

- IDEA-131854 Whole Word search matches partial occurrences
This commit is contained in:
Maxim.Mossienko
2015-07-17 23:54:02 +02:00
parent 0d29b083c7
commit ef7909b504
2 changed files with 65 additions and 9 deletions
@@ -590,6 +590,37 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
FindManagerTestUtils.runFindInCommentsAndLiterals(myFindManager, findModel, text);
}
public void testReplacePreserveCase() {
configureByText(FileTypes.PLAIN_TEXT, "Bar bar BAR");
FindModel model = new FindModel();
model.setStringToFind("bar");
model.setStringToReplace("foo");
model.setPromptOnReplace(false);
model.setPreserveCase(true);
FindUtil.replace(myProject, myEditor, 0, model);
assertEquals("Foo foo FOO", myEditor.getDocument().getText());
configureByText(FileTypes.PLAIN_TEXT, "Bar bar");
model.setStringToFind("bar");
model.setStringToReplace("fooBar");
FindUtil.replace(myProject, myEditor, 0, model);
assertEquals("FooBar fooBar", myEditor.getDocument().getText());
}
public void testFindWholeWords() {
configureByText(FileTypes.PLAIN_TEXT, "-- -- ---");
FindModel model = new FindModel();
model.setStringToFind("--");
model.setWholeWordsOnly(true);
List<Usage> usages = FindUtil.findAll(myProject, myEditor, model);
assertNotNull(usages);
assertEquals(2, usages.size());
}
public void testFindInCurrentFileOutsideProject() throws Exception {
final TempDirTestFixture tempDirFixture = new TempDirTestFixtureImpl();
tempDirFixture.setUp();