Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalyan Prasad Tatavarthi2018-07-30 09:45:56 +0000
committerKalyan Prasad Tatavarthi2018-07-30 09:48:18 +0000
commitc8c61ceaae40fb7480be6c7f29082aea579b47b5 (patch)
tree8c613595c7605f0ae1c081e7b0f23aa75141f09b /org.eclipse.text.tests
parente18255b8f790682a2a9e9778cfcbf52de4f9c859 (diff)
downloadeclipse.platform.text-c8c61ceaae40fb7480be6c7f29082aea579b47b5.tar.gz
eclipse.platform.text-c8c61ceaae40fb7480be6c7f29082aea579b47b5.tar.xz
eclipse.platform.text-c8c61ceaae40fb7480be6c7f29082aea579b47b5.zip
Bug 109481 - [find/replace] replace doesn't work when using a regex withI20180730-2240I20180730-2000I20180730-0800
a lookahead or boundary matchers :- Reverting Changes as a result of Bug 537377 Change-Id: I975d326e67f650bc2dddac6948775b3bb3fbdf5a Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com>
Diffstat (limited to 'org.eclipse.text.tests')
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java26
1 files changed, 1 insertions, 25 deletions
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
index a51c2b55c4c..01e6ad5e1e4 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation
* Cagatay Calli <ccalli@gmail.com> - [find/replace] retain caps when replacing - https://bugs.eclipse.org/bugs/show_bug.cgi?id=28949
* Cagatay Calli <ccalli@gmail.com> - [find/replace] define & fix behavior of retain caps with other escapes and text before \C - https://bugs.eclipse.org/bugs/show_bug.cgi?id=217061
- * Florian Ingerl <imelflorianingerl@gmail.com> - [find/replace] replace doesn't work when using a regex with a lookahead or boundary matchers - https://bugs.eclipse.org/bugs/show_bug.cgi?id=109481
*******************************************************************************/
package org.eclipse.text.tests;
@@ -501,27 +500,4 @@ public class FindReplaceDocumentAdapterTest {
}
fail();
}
-
- @Test
- public void testRegexReplaceWithLookarounds() throws Exception {
- fDocument.set("1<2<3<4");
- replaceAllRegex("(?<=(\\d))\\<(\\d)(?=\\<(\\d))", "<($1+$3)/2=$2", true);
- assertEquals("1<(1+3)/2=2<(2+4)/2=3<4", fDocument.get());
-
- fDocument.set("1<2<3<4");
- replaceAllRegex("(?<=(\\d)\\<)(\\d)\\<(?=(\\d))", "$2=($1+$3)/2<", false);
- assertEquals("1<2=(1+3)/2<3=(2+4)/2<4", fDocument.get());
- }
-
- private void replaceAllRegex(String findString, String replaceString, boolean forwardSearch) throws BadLocationException {
- FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
-
- int index= forwardSearch ? 0 : fDocument.getLength();
- while(index!=-1) {
- if(findReplaceDocumentAdapter.find(index, findString, forwardSearch, true, false, true)==null)
- break;
- IRegion region= findReplaceDocumentAdapter.replace(replaceString, true);
- index= forwardSearch ? region.getOffset() + region.getLength() : region.getOffset() - 1;
- }
- }
}

Back to the top