~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge3.py

  • Committer: Andrew Bennetts
  • Date: 2010-04-22 14:03:56 UTC
  • mto: This revision was merged to the branch mainline in revision 5181.
  • Revision ID: andrew.bennetts@canonical.com-20100422140356-zv9iwa7eebxwjh2v
Add a test for the allow_objects param of Merge3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
422
422
                             'g\n'
423
423
                             '>>>>>>>\n',
424
424
                             ''.join(m_lines))
 
425
 
 
426
    def test_allow_objects(self):
 
427
        """Objects other than strs may be used with Merge3 when
 
428
        allow_objects=True.
 
429
        
 
430
        merge_groups and merge_regions work with non-str input.  Methods that
 
431
        return lines like merge_lines fail.
 
432
        """
 
433
        base = [(x,x) for x in 'abcde']
 
434
        a = [(x,x) for x in 'abcdef']
 
435
        b = [(x,x) for x in 'Zabcde']
 
436
        m3 = Merge3(base, a, b, allow_objects=True)
 
437
        self.assertEqual(
 
438
            [('b', 0, 1),
 
439
             ('unchanged', 0, 5),
 
440
             ('a', 5, 6)],
 
441
            list(m3.merge_regions()))
 
442
        self.assertEqual(
 
443
            [('b', [('Z', 'Z')]),
 
444
             ('unchanged', [(x,x) for x in 'abcde']),
 
445
             ('a', [('f', 'f')])],
 
446
            list(m3.merge_groups()))
 
447