~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testweave.py

  • Committer: Martin Pool
  • Date: 2005-06-28 13:55:37 UTC
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: mbp@sourcefrog.net-20050628135537-c0c108af5964d508
Handle deletion of lines by marking the region with a deletion

Test deletions

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
 
178
178
 
179
179
 
 
180
class DeleteLines(TestBase):
 
181
    """Deletion of lines from existing text.
 
182
 
 
183
    Try various texts all based on a common ancestor."""
 
184
    def runTest(self):
 
185
        k = Weave()
 
186
 
 
187
        base_text = ['one', 'two', 'three', 'four']
 
188
 
 
189
        k.add([], base_text)
 
190
        
 
191
        texts = [['one', 'two', 'three'],
 
192
                 ['two', 'three', 'four'],
 
193
                 ['one', 'four'],
 
194
                 ['one', 'two', 'three', 'four'],
 
195
                 ]
 
196
 
 
197
        for t in texts:
 
198
            ver = k.add([0], t)
 
199
 
 
200
        from pprint import pformat
 
201
        self.log('final weave:')
 
202
        self.log('k._l=' + pformat(k._l))
 
203
 
 
204
        for i in range(len(texts)):
 
205
            self.assertEqual(k.get(i+1),
 
206
                             texts[i])
 
207
            
 
208
 
 
209
 
 
210
 
180
211
class SuicideDelete(TestBase):
181
212
    """Invalid weave which tries to add and delete simultaneously."""
182
213
    def runTest(self):
362
393
                         
363
394
 
364
395
 
365
 
class DeleteLines(TestBase):
 
396
class DeleteLines2(TestBase):
366
397
    """Test recording revisions that delete lines.
367
398
 
368
399
    This relies on the weave having a way to represent lines knocked
377
408
 
378
409
        self.assertEqual(len(k.get(0)), 4)
379
410
 
380
 
        return ################################## SKIPPED
381
 
 
382
411
        k.add([0], ["line the first",
383
412
                   "fine"])
384
413
 
386
415
                         ["line the first",
387
416
                          "fine"])
388
417
 
 
418
        self.assertEqual(k.annotate(1),
 
419
                         [(0, "line the first"),
 
420
                          (0, "fine")])
 
421
 
389
422
 
390
423
 
391
424
class IncludeVersions(TestBase):