/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2008-12-11 02:02:07 UTC
  • mto: This revision was merged to the branch mainline in revision 3895.
  • Revision ID: john@arbash-meinel.com-20081211020207-rrgdcyqc344zo5q1
Change name to 'chunks_to_lines', and find an optimized form.

It is a little bit ugly, but it is faster than join & split, and means
we get to leave the strings untouched.

Show diffs side-by-side

added added

removed removed

Lines of Context:
756
756
        self.assertEndsWith(osutils._mac_getcwd(), u'B\xe5gfors')
757
757
 
758
758
 
759
 
class TestChunkedToLines(TestCase):
 
759
class TestChunksToLines(TestCase):
760
760
 
761
761
    def assertChunksToLines(self, lines, chunks):
762
 
        self.assertEqual(lines, osutils.chunked_to_lines(chunks))
 
762
        self.assertEqual(lines, osutils.chunks_to_lines(chunks))
763
763
 
764
764
    def test_fulltext_chunk_to_lines(self):
765
765
        self.assertChunksToLines(['foo\n', 'bar\r\n', 'ba\rz\n'],
778
778
    def test_mixed(self):
779
779
        self.assertChunksToLines(['foo\n', 'bar\r\n', 'ba\rz'],
780
780
                                 ['foo\n', 'bar\r\nba\r', 'z'])
 
781
        self.assertChunksToLines(['foo\n', 'bar\r\n', 'ba\rz'],
 
782
                                 ['foo\nb', 'a', 'r\r\nba\r', 'z'])
 
783
        self.assertChunksToLines(['foo\n', 'bar\r\n', 'ba\rz'],
 
784
                                 ['foo\nbar\r\nba', '\r', 'z'])
 
785
 
 
786
        self.assertChunksToLines(['foo\n', 'bar\r\n', 'ba\rz'],
 
787
                                 ['foo\n', '', 'bar\r\nba', '\r', 'z'])
781
788
 
782
789
 
783
790
class TestSplitLines(TestCase):