~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack.py

  • Committer: Andrew Bennetts
  • Date: 2009-07-27 05:35:00 UTC
  • mfrom: (4570 +trunk)
  • mto: (4634.6.29 2.0)
  • mto: This revision was merged to the branch mainline in revision 4680.
  • Revision ID: andrew.bennetts@canonical.com-20090727053500-q76zsn2dx33jhmj5
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Tests for bzrlib.pack."""
18
18
 
68
68
class TestContainerWriter(tests.TestCase):
69
69
 
70
70
    def setUp(self):
 
71
        tests.TestCase.setUp(self)
71
72
        self.output = StringIO()
72
73
        self.writer = pack.ContainerWriter(self.output.write)
73
74
 
609
610
            [([('name1',)], 'body1'), ([('name2',)], 'body2')],
610
611
            parser.read_pending_records())
611
612
 
 
613
    def test_multiple_empty_records_at_once(self):
 
614
        """If multiple empty records worth of data are fed to the parser in one
 
615
        string, the parser will correctly parse all the records.
 
616
 
 
617
        (A naive implementation might stop after parsing the first empty
 
618
        record, because the buffer size had not changed.)
 
619
        """
 
620
        parser = self.make_parser_expecting_record_type()
 
621
        parser.accept_bytes("B0\nname1\n\nB0\nname2\n\n")
 
622
        self.assertEqual(
 
623
            [([('name1',)], ''), ([('name2',)], '')],
 
624
            parser.read_pending_records())
 
625
 
612
626
 
613
627
class TestContainerPushParserBytesParsing(PushParserTestCase):
614
628
    """Tests for reading Bytes records with ContainerPushParser.