/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_knit.py

  • Committer: John Arbash Meinel
  • Date: 2006-12-18 19:21:11 UTC
  • mfrom: (2196 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2209.
  • Revision ID: john@arbash-meinel.com-20061218192111-3fc13nmt21u3f1wm
[merge] bzr.dev 2196

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import difflib
21
21
 
22
22
 
 
23
from bzrlib import errors
23
24
from bzrlib.errors import KnitError, RevisionAlreadyPresent, NoSuchFile
24
25
from bzrlib.knit import (
25
26
    KnitContent,
85
86
        self.assertEqual(it.next(), (1, 2, 2, [("", "a"), ("", "c")]))
86
87
        self.assertRaises(StopIteration, it.next)
87
88
 
 
89
 
88
90
class KnitTests(TestCaseWithTransport):
89
91
    """Class containing knit test helper routines."""
90
92
 
746
748
        # And it shouldn't be modified
747
749
        self.assertEqual(['a-1'], idx._history)
748
750
        self.assertEqual({'a-1':('a-1', ['fulltext'], 0, 0, [], 0)}, idx._cache)
 
751
 
 
752
    def test_knit_index_ignores_empty_files(self):
 
753
        # There was a race condition in older bzr, where a ^C at the right time
 
754
        # could leave an empty .kndx file, which bzr would later claim was a
 
755
        # corrupted file since the header was not present. In reality, the file
 
756
        # just wasn't created, so it should be ignored.
 
757
        t = get_transport('.')
 
758
        t.put_bytes('test.kndx', '')
 
759
 
 
760
        knit = self.make_test_knit()
 
761
 
 
762
    def test_knit_index_checks_header(self):
 
763
        t = get_transport('.')
 
764
        t.put_bytes('test.kndx', '# not really a knit header\n\n')
 
765
 
 
766
        self.assertRaises(errors.KnitHeaderError, self.make_test_knit)