use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.
the class UtilTest method testConcatenateEquals.
public void testConcatenateEquals() {
prepareForFragments();
DiffFragment fragments = Util.concatenate(new DiffFragment[] { new DiffFragment("a", "a"), DiffFragment.unchanged("1", "XY"), DiffFragment.unchanged("2\n3", "Q\nW\nE") });
assertTrue(fragments.isEqual());
assertFalse(fragments.isOneSide());
assertEquals("a12\n3", fragments.getText1());
assertEquals("aXYQ\nW\nE", fragments.getText2());
}
use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.
the class ByWordTest method testLeadingFormatting.
public void testLeadingFormatting() throws FilesTooBigForDiffException {
DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
DiffFragment[] fragments = byWord.buildFragments(" abc\n 123", " 123");
CHECK.compareAll(new DiffFragment[] { new DiffFragment(" abc\n", null), new DiffFragment(" 123", " 123") }, UniteSameType.INSTANCE.correct(fragments));
}
use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.
the class ByWordTest method test4.
public void test4() throws FilesTooBigForDiffException {
DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
DiffFragment[] fragments = byWord.buildFragments(" abc\n2222\n", " x = abc\nzzzz\n");
CHECK.compareAll(new DiffFragment[] { new DiffFragment(null, " "), new DiffFragment(" ", " "), new DiffFragment(null, "x"), new DiffFragment(null, " ="), new DiffFragment(null, " "), new DiffFragment("abc\n", "abc\n"), new DiffFragment("2222", "zzzz"), new DiffFragment("\n", "\n") }, fragments);
}
use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.
the class ByWordTest method test1.
public void test1() throws FilesTooBigForDiffException {
DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
DiffFragment[] fragments = byWord.buildFragments("abc def, 123", "ab def, 12");
CHECK.compareAll(new DiffFragment[] { new DiffFragment("abc", "ab"), new DiffFragment(" def, ", " def, "), new DiffFragment("123", "12") }, fragments);
}
use of com.intellij.openapi.diff.ex.DiffFragment in project intellij-community by JetBrains.
the class ByWordTest method testRestyleNewLines.
public void testRestyleNewLines() throws FilesTooBigForDiffException {
DiffPolicy byWord = new ByWord(ComparisonPolicy.DEFAULT);
DiffFragment[] fragments = byWord.buildFragments("f(a, b);", "f(a,\n b);");
CHECK.compareAll(new DiffFragment[] { new DiffFragment("f(a,", "f(a,"), new DiffFragment(" ", "\n "), new DiffFragment("b);", "b);") }, UniteSameType.INSTANCE.correct(fragments));
}
Aggregations