~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to test_multiparent.py

  • Committer: Aaron Bentley
  • Date: 2007-04-13 20:34:16 UTC
  • mto: (2520.4.1 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070413203416-7jeoifz1gq41ashn
Implement save, load, snapshot-by-size

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from unittest import TestCase
2
2
 
 
3
from bzrlib import tests
 
4
 
3
5
import multiparent
4
6
 
5
7
 
185
187
        vf.clear_cache()
186
188
        lines = vf.get_line_list(['rev-e'])[0]
187
189
        self.assertEqual(['b\n', 'a\n'], lines)
 
190
 
 
191
 
 
192
class TestMultiVersionedFile(tests.TestCaseInTempDir):
 
193
 
 
194
    def test_save_load(self):
 
195
        vf = multiparent.MultiVersionedFile('foop')
 
196
        vf.add_version('a\nb\nc\nd'.splitlines(True), 'a', [])
 
197
        vf.add_version('a\ne\nd\n'.splitlines(True), 'b', ['a'])
 
198
        vf.save()
 
199
        newvf = multiparent.MultiVersionedFile('foop')
 
200
        newvf.load()
 
201
        self.assertEqual('a\nb\nc\nd', ''.join(newvf.get_line_list(['a'])[0]))
 
202
        self.assertEqual('a\ne\nd\n', ''.join(newvf.get_line_list(['b'])[0]))
 
203
 
 
204
    def test_filenames(self):
 
205
        vf = multiparent.MultiVersionedFile('foop')
 
206
        vf.add_version('a\nb\nc\nd'.splitlines(True), 'a', [])
 
207
        self.failUnlessExists('foop.mpknit')
 
208
        self.failIfExists('foop.mpidx')
 
209
        vf.save()
 
210
        self.failUnlessExists('foop.mpidx')
 
211
        vf.destroy()
 
212
        self.failIfExists('foop.mpknit')
 
213
        self.failIfExists('foop.mpidx')