~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testknit.py

  • Committer: Martin Pool
  • Date: 2005-06-27 03:31:58 UTC
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: mbp@sourcefrog.net-20050627033158-c86b5bf3deda0f47
Knit structure now allows for versions to include the lines present in other 
versions.  (Not applied transitively for the moment.)  This is applied when 
unpacking texts.

Start adding Knit.check()

Hand-pack a knit and check that included versions are respected when 
unpacking lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
        self.assertEqual(k.get(0), TEXT_0)
67
67
        self.assertEqual(k.get(1), TEXT_1)
68
68
 
 
69
        k.dump(self.TEST_LOG)
 
70
 
 
71
 
 
72
class MatchedLine(TestBase):
 
73
    """Store a revision that adds one line to the original.
 
74
 
 
75
    Look at the annotations to make sure that the first line is matched
 
76
    and not stored repeatedly."""
 
77
    def runTest(self):
 
78
        return #################################### SKIPPED
 
79
        k = Knit()
 
80
 
 
81
        k.add(['line 1'])
 
82
        k.add(['line 1', 'line 2'])
 
83
 
 
84
        self.assertEqual(k.annotate(0),
 
85
                         [(0, 'line 1')])
 
86
 
 
87
        self.assertEqual(k.annotate(1),
 
88
                         [(0, 'line 1'),
 
89
                          (1, 'line 2')])
 
90
 
 
91
 
 
92
class IncludeVersions(TestBase):
 
93
    """Check texts that are stored across multiple revisions.
 
94
 
 
95
    Here we manually create a knit with particular encoding and make
 
96
    sure it unpacks properly.
 
97
 
 
98
    Text 0 includes nothing; text 1 includes text 0 and adds some
 
99
    lines.
 
100
    """
 
101
 
 
102
    def runTest(self):
 
103
        k = Knit()
 
104
 
 
105
        k._v = [((),), ((0,),)]
 
106
        k._l = [(0, "first line"),
 
107
                (1, "second line")]
 
108
 
 
109
        self.assertEqual(k.get(1),
 
110
                         ["first line",
 
111
                          "second line"])
 
112
 
 
113
        self.assertEqual(k.get(0),
 
114
                         ["first line"])
 
115
 
 
116
        k.dump(self.TEST_LOG)
 
117
 
69
118
 
70
119
def testknit():
71
120
    import testsweet