diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2011-05-17 08:54:18 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-05-17 08:54:18 -0400 |
commit | d781554b79b50e5c3fe468373e87edf8957d7578 (patch) | |
tree | 319c8f4409ac53987b7aba8cdc3813aff1c9f6a9 /org.eclipse.jgit.test | |
parent | b13ca9121b8f2c6a0ebca1a2a12c4af7e75dfd20 (diff) | |
parent | 0461ff4f0c7ef505c818dac95286fa852f16eef7 (diff) | |
download | jgit-d781554b79b50e5c3fe468373e87edf8957d7578.tar.gz jgit-d781554b79b50e5c3fe468373e87edf8957d7578.zip |
Merge "Optimize MergeAlgorithm if ours or theirs is empty"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java index aa8f8281e4..8a33425b1d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java @@ -198,6 +198,25 @@ public class MergeAlgorithmTest { } + /** + * Test situations where (at least) one input value is the empty text + * + * @throws IOException + */ + @Test + public void testEmptyTexts() throws IOException { + // test modification against deletion + assertEquals(t("<AB=>"), merge("A", "AB", "")); + assertEquals(t("<=AB>"), merge("A", "", "AB")); + + // test unmodified against deletion + assertEquals(t(""), merge("AB", "AB", "")); + assertEquals(t(""), merge("AB", "", "AB")); + + // test deletion against deletion + assertEquals(t(""), merge("AB", "", "")); + } + private String merge(String commonBase, String ours, String theirs) throws IOException { MergeResult r = new MergeAlgorithm().merge(RawTextComparator.DEFAULT, T(commonBase), T(ours), T(theirs)); @@ -231,5 +250,4 @@ public class MergeAlgorithmTest { public static RawText T(String text) { return new RawText(Constants.encode(t(text))); } - } |