~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge3.py

  • Committer: Robert Collins
  • Date: 2007-07-04 08:08:13 UTC
  • mfrom: (2572 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20070704080813-wzebx0r88fvwj5rq
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005 by Canonical Ltd
 
1
# Copyright (C) 2004, 2005 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
363
363
 
364
364
    def test_binary(self):
365
365
        self.assertRaises(BinaryFile, Merge3, ['\x00'], ['a'], ['b'])
 
366
 
 
367
    def test_dos_text(self):
 
368
        base_text = 'a\r\n'
 
369
        this_text = 'b\r\n'
 
370
        other_text = 'c\r\n'
 
371
        m3 = Merge3(base_text.splitlines(True), other_text.splitlines(True),
 
372
                    this_text.splitlines(True))
 
373
        m_lines = m3.merge_lines('OTHER', 'THIS')
 
374
        self.assertEqual('<<<<<<< OTHER\r\nc\r\n=======\r\nb\r\n'
 
375
            '>>>>>>> THIS\r\n'.splitlines(True), list(m_lines))
 
376
 
 
377
    def test_mac_text(self):
 
378
        base_text = 'a\r'
 
379
        this_text = 'b\r'
 
380
        other_text = 'c\r'
 
381
        m3 = Merge3(base_text.splitlines(True), other_text.splitlines(True),
 
382
                    this_text.splitlines(True))
 
383
        m_lines = m3.merge_lines('OTHER', 'THIS')
 
384
        self.assertEqual('<<<<<<< OTHER\rc\r=======\rb\r'
 
385
            '>>>>>>> THIS\r'.splitlines(True), list(m_lines))