~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack.py

  • Committer: Aaron Bentley
  • Date: 2009-06-20 01:17:38 UTC
  • mto: This revision was merged to the branch mainline in revision 4465.
  • Revision ID: aaron@aaronbentley.com-20090620011738-ui5v1f48fluueiix
ContainerPushParser.accept_bytes handles zero-length records correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
610
610
            [([('name1',)], 'body1'), ([('name2',)], 'body2')],
611
611
            parser.read_pending_records())
612
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
 
613
626
 
614
627
class TestContainerPushParserBytesParsing(PushParserTestCase):
615
628
    """Tests for reading Bytes records with ContainerPushParser.