~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-06-20 02:58:19 UTC
  • mfrom: (4464.1.2 fix-shelf)
  • Revision ID: pqm@pqm.ubuntu.com-20090620025819-9fkf33yr3dvtwh2o
(abentley) Fix #363444 by fixing pack parsing with 0-length records.

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.