~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/testweave.py

  • Committer: Martin Pool
  • Date: 2005-07-18 10:21:56 UTC
  • Revision ID: mbp@sourcefrog.net-20050718102156-43412609dc86cbba
- log weave for merge tests to help debugging
- remove test that depends too much on the implementation of delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
 
107
107
 
108
108
 
109
 
class DeltaAdd(TestBase):
110
 
    """Detection of changes prior to inserting new revision."""
111
 
    def runTest(self):
112
 
        k = Weave()
113
 
        k.add([], ['line 1'])
114
 
 
115
 
        self.assertEqual(k._l,
116
 
                         [('{', 0),
117
 
                          'line 1',
118
 
                          ('}', 0),
119
 
                          ])
120
 
 
121
 
        changes = list(k._delta(IntSet([0]),
122
 
                                ['line 1',
123
 
                                 'new line']))
124
 
 
125
 
        self.log('raw changes: ' + pformat(changes))
126
 
 
127
 
        # currently there are 3 lines in the weave, and we insert after them
128
 
        self.assertEquals(changes,
129
 
                          [(3, 3, ['new line'])])
130
 
 
131
 
        changes = k._delta(set([0]),
132
 
                           ['top line',
133
 
                            'line 1'])
134
 
        
135
 
        self.assertEquals(list(changes),
136
 
                          [(1, 1, ['top line'])])
137
 
 
138
 
        self.check_read_write(k)
139
 
 
140
 
 
141
109
class InvalidAdd(TestBase):
142
110
    """Try to use invalid version number during add."""
143
111
    def runTest(self):
700
668
        w.add([0], map(addcrlf, a))
701
669
        w.add([0], map(addcrlf, b))
702
670
 
 
671
        self.log('weave is:')
 
672
        tmpf = StringIO()
 
673
        write_weave(w, tmpf)
 
674
        self.log(tmpf.getvalue())
 
675
 
703
676
        self.log('merge plan:')
704
677
        p = list(w.plan_merge(1, 2))
705
678
        for state, line in p: