Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java')
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java56
1 files changed, 28 insertions, 28 deletions
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java
index 5c8b7c6f7..1f08dd467 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
public class DocLineComparatorTest extends TestCase {
-
+
public DocLineComparatorTest(String name) {
super(name);
}
@@ -40,10 +40,10 @@ public class DocLineComparatorTest extends TestCase {
public void testRangesEqual() {
IDocument doc1= new Document();
doc1.set("if (s.strip))"); //$NON-NLS-1$
-
+
IDocument doc2= new Document();
doc2.set("if (s.strip)"); //$NON-NLS-1$
-
+
IRangeComparator comp1= new DocLineComparator(doc1, null, true);
IRangeComparator comp2= new DocLineComparator(doc2, null, true);
@@ -53,10 +53,10 @@ public class DocLineComparatorTest extends TestCase {
public void testWhitespaceAtEnd() {
IDocument doc1= new Document();
doc1.set("if (s.strip))"); //$NON-NLS-1$
-
+
IDocument doc2= new Document();
doc2.set("if (s.strip)) "); //$NON-NLS-1$
-
+
IRangeComparator comp1= new DocLineComparator(doc1, null, true);
IRangeComparator comp2= new DocLineComparator(doc2, null, true);
@@ -192,7 +192,7 @@ public class DocLineComparatorTest extends TestCase {
new ICompareFilter[] { filter2, filter3 }, 'R');
Assert.assertFalse(comp3.rangesEqual(0, comp4, 0));
}
-
+
public void testWhitespace() {
IDocument[] docs = new IDocument[6];
docs[0] = new Document();
@@ -201,14 +201,14 @@ public class DocLineComparatorTest extends TestCase {
docs[3] = new Document();
docs[4] = new Document();
docs[5] = new Document();
-
+
docs[0].set("if (s.strip))\r\n");//$NON-NLS-1$
docs[1].set("if (s.strip))\n"); //$NON-NLS-1$
docs[2].set("if (s .strip))\n"); //$NON-NLS-1$
docs[3].set("if (s.str ip))\r"); //$NON-NLS-1$
docs[4].set("if (s.strip))"); //$NON-NLS-1$
docs[5].set("if (s.stri p))"); //$NON-NLS-1$
-
+
ICompareFilter[][] filters = new ICompareFilter[3][];
filters[0] = null;
filters[1] = new ICompareFilter[]{
@@ -218,21 +218,21 @@ public class DocLineComparatorTest extends TestCase {
Object right) {
// EMPTY
}
-
+
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(0, 2) };
}
-
+
public boolean isEnabledInitially() {
return false;
}
-
+
public boolean canCacheFilteredRegions() {
return true; // cache-able
}
}
};
-
+
filters[2] = new ICompareFilter[]{
new ICompareFilter() {
@@ -240,15 +240,15 @@ public class DocLineComparatorTest extends TestCase {
Object right) {
// EMPTY
}
-
+
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(0, 2) };
}
-
+
public boolean isEnabledInitially() {
return false;
}
-
+
public boolean canCacheFilteredRegions() {
return false; // not cache-able
}
@@ -262,7 +262,7 @@ public class DocLineComparatorTest extends TestCase {
l = new DocLineComparator(docs[i], null, false, filters[k], 'L');
r = new DocLineComparator(docs[j], null, false, filters[k], 'R');
Assert.assertFalse(l.rangesEqual(0, r, 0));
-
+
l = new DocLineComparator(docs[i], null, true, filters[k], 'L');
r = new DocLineComparator(docs[j], null, true, filters[k], 'R');
Assert.assertTrue(l.rangesEqual(0, r, 0));
@@ -272,10 +272,10 @@ public class DocLineComparatorTest extends TestCase {
public void testEmpty() {
IDocument doc1= new Document();
doc1.set(""); //$NON-NLS-1$
-
+
IDocument doc2= new Document();
doc2.set(" "); //$NON-NLS-1$
-
+
IRangeComparator comp1= new DocLineComparator(doc1, null, true);
IRangeComparator comp2= new DocLineComparator(doc2, null, true);
@@ -284,7 +284,7 @@ public class DocLineComparatorTest extends TestCase {
public void testNoContent() {
IDocument doc= new Document();
-
+
IRangeComparator comp1= new DocLineComparator(doc, null, true);
IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true);
@@ -292,43 +292,43 @@ public class DocLineComparatorTest extends TestCase {
Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount());
Assert.assertEquals(1, comp2.getRangeCount());
}
-
+
public void testOneLine() {
IDocument doc = new Document();
doc.set("line1"); //$NON-NLS-1$
-
+
IRangeComparator comp1= new DocLineComparator(doc, null, true);
IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true);
Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount());
Assert.assertEquals(1, comp2.getRangeCount());
}
-
+
public void testTwoLines() {
IDocument doc = new Document();
doc.set("line1\nline2"); //$NON-NLS-1$
-
+
IRangeComparator comp1= new DocLineComparator(doc, null, true);
IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true);
Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount());
Assert.assertEquals(2, comp2.getRangeCount());
-
+
IRangeComparator comp3= new DocLineComparator(doc, new Region(0, "line1".length()), true);
Assert.assertEquals(1, comp3.getRangeCount());
-
+
comp3= new DocLineComparator(doc, new Region(0, "line1".length()+1), true);
Assert.assertEquals(2, comp3.getRangeCount()); // two lines
}
-
+
public void testBug259422() {
IDocument doc = new Document();
doc.set(""); //$NON-NLS-1$
-
+
IRangeComparator comp1= new DocLineComparator(doc, null, true);
IRangeComparator comp2= new DocLineComparator(doc, new Region(0, doc.getLength()), true);
Assert.assertEquals(comp1.getRangeCount(), comp2.getRangeCount());
}
-
+
}

Back to the top