[Pkg-bazaar-commits] ./bzr/unstable r831: - add merge3 test case from Lao-Tzu
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:13:40 UTC 2009
------------------------------------------------------------
revno: 831
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Tue 2005-07-05 19:13:09 +1000
message:
- add merge3 test case from Lao-Tzu
modified:
bzrlib/selftest/testmerge3.py
-------------- next part --------------
=== modified file 'bzrlib/selftest/testmerge3.py'
--- a/bzrlib/selftest/testmerge3.py 2005-07-05 09:04:24 +0000
+++ b/bzrlib/selftest/testmerge3.py 2005-07-05 09:13:09 +0000
@@ -18,6 +18,10 @@
from bzrlib.selftest import InTempDir, TestBase
from bzrlib.merge3 import Merge3
+
+
+
+
class NoChanges(TestBase):
"""No conflicts because nothing changed"""
def runTest(self):
@@ -193,3 +197,88 @@
+
+
+
+
+def split_lines(t):
+ from cStringIO import StringIO
+ return StringIO(t).readlines()
+
+
+# common base
+TZU = split_lines(""" The Nameless is the origin of Heaven and Earth;
+ The named is the mother of all things.
+
+ Therefore let there always be non-being,
+ so we may see their subtlety,
+ And let there always be being,
+ so we may see their outcome.
+ The two are the same,
+ But after they are produced,
+ they have different names.
+ They both may be called deep and profound.
+ Deeper and more profound,
+ The door of all subtleties!
+""")
+
+LAO = split_lines(""" The Way that can be told of is not the eternal Way;
+ The name that can be named is not the eternal name.
+ The Nameless is the origin of Heaven and Earth;
+ The Named is the mother of all things.
+ Therefore let there always be non-being,
+ so we may see their subtlety,
+ And let there always be being,
+ so we may see their outcome.
+ The two are the same,
+ But after they are produced,
+ they have different names.
+""")
+
+
+TAO = split_lines(""" The Way that can be told of is not the eternal Way;
+ The name that can be named is not the eternal name.
+ The Nameless is the origin of Heaven and Earth;
+ The named is the mother of all things.
+
+ Therefore let there always be non-being,
+ so we may see their subtlety,
+ And let there always be being,
+ so we may see their result.
+ The two are the same,
+ But after they are produced,
+ they have different names.
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+
+""")
+
+MERGED_RESULT = split_lines(""" The Way that can be told of is not the eternal Way;
+ The name that can be named is not the eternal name.
+ The Nameless is the origin of Heaven and Earth;
+ The Named is the mother of all things.
+ Therefore let there always be non-being,
+ so we may see their subtlety,
+ And let there always be being,
+ so we may see their result.
+ The two are the same,
+ But after they are produced,
+ they have different names.
+<<<<<<<< LAO
+========
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+
+>>>>>>>> TAO
+""")
+
+
+
+class MergePoem(TestBase):
+ """Test case from diff3 manual"""
+ def runTest(self):
+ m3 = Merge3(TZU, LAO, TAO)
+ ml = list(m3.merge_lines('LAO', 'TAO'))
+ self.log('merge result:')
+ self.log(''.join(ml))
+ self.assertEquals(ml, MERGED_RESULT)
More information about the Pkg-bazaar-commits
mailing list