~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testmerge3.py

  • Committer: Martin Pool
  • Date: 2005-07-06 00:37:03 UTC
  • Revision ID: mbp@sourcefrog.net-20050706003703-7ae9be78690ee6d9
- more merge tests from john

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
 
109
109
 
110
110
 
 
111
class AppendA(TestBase):
 
112
    def runTest(self):
 
113
        m3 = Merge3(['aaa\n', 'bbb\n'],
 
114
                    ['aaa\n', 'bbb\n', '222\n'],
 
115
                    ['aaa\n', 'bbb\n'])
 
116
 
 
117
        self.assertEquals(''.join(m3.merge_lines()),
 
118
                          'aaa\nbbb\n222\n')
 
119
 
 
120
class AppendB(TestBase):
 
121
    def runTest(self):
 
122
        m3 = Merge3(['aaa\n', 'bbb\n'],
 
123
                    ['aaa\n', 'bbb\n'],
 
124
                    ['aaa\n', 'bbb\n', '222\n'])
 
125
 
 
126
        self.assertEquals(''.join(m3.merge_lines()),
 
127
                          'aaa\nbbb\n222\n')
 
128
 
 
129
class AppendAgreement(TestBase):
 
130
    def runTest(self):
 
131
        m3 = Merge3(['aaa\n', 'bbb\n'],
 
132
                    ['aaa\n', 'bbb\n', '222\n'],
 
133
                    ['aaa\n', 'bbb\n', '222\n'])
 
134
 
 
135
        self.assertEquals(''.join(m3.merge_lines()),
 
136
                          'aaa\nbbb\n222\n')
 
137
 
 
138
class AppendClash(TestBase):
 
139
    def runTest(self):
 
140
        m3 = Merge3(['aaa\n', 'bbb\n'],
 
141
                    ['aaa\n', 'bbb\n', '222\n'],
 
142
                    ['aaa\n', 'bbb\n', '333\n'])
 
143
 
 
144
        ml = m3.merge_lines(name_a='a',
 
145
                            name_b='b',
 
146
                            start_marker='<<',
 
147
                            mid_marker='--',
 
148
                            end_marker='>>')
 
149
        self.assertEquals(''.join(ml),
 
150
'''\
 
151
aaa
 
152
bbb
 
153
<< a
 
154
222
 
155
--
 
156
333
 
157
>> b
 
158
''')
 
159
 
 
160
 
111
161
class InsertAgreement(TestBase):
112
162
    def runTest(self):
113
163
        m3 = Merge3(['aaa\n', 'bbb\n'],
114
164
                    ['aaa\n', '222\n', 'bbb\n'],
115
165
                    ['aaa\n', '222\n', 'bbb\n'])
116
166
 
 
167
        ml = m3.merge_lines(name_a='a',
 
168
                            name_b='b',
 
169
                            start_marker='<<',
 
170
                            mid_marker='--',
 
171
                            end_marker='>>')
117
172
        self.assertEquals(''.join(m3.merge_lines()),
118
173
                          'aaa\n222\nbbb\n')
119
174
 
120
175
 
121
176
 
 
177
 
122
178
class InsertClash(TestBase):
123
179
    """Both try to insert lines in the same place."""
124
180
    def runTest(self):