~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

[merge] bzr.dev 1815

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.bundle.bundle_data import BundleTree
23
23
from bzrlib.bundle.serializer import write_bundle, read_bundle
24
24
from bzrlib.diff import internal_diff
25
 
from bzrlib.errors import BzrError, TestamentMismatch, NotABundle
 
25
from bzrlib.errors import BzrError, TestamentMismatch, NotABundle, BadBundle
26
26
from bzrlib.merge import Merge3Merger
27
27
from bzrlib.osutils import has_symlinks, sha_file
28
28
from bzrlib.tests import (TestCaseInTempDir, TestCaseWithTransport,
363
363
    def test_non_bundle(self):
364
364
        self.assertRaises(NotABundle, read_bundle, StringIO('#!/bin/sh\n'))
365
365
 
 
366
    def test_malformed(self):
 
367
        self.assertRaises(BadBundle, read_bundle, 
 
368
                          StringIO('# Bazaar revision bundle v'))
 
369
 
 
370
    def test_crlf_bundle(self):
 
371
        try:
 
372
            read_bundle(StringIO('# Bazaar revision bundle v0.7\r\n'))
 
373
        except BadBundle:
 
374
            # It is currently permitted for bundles with crlf line endings to
 
375
            # make read_bundle raise a BadBundle, but this should be fixed.
 
376
            # Anything else, especially NotABundle, is an error.
 
377
            pass
 
378
 
366
379
    def get_checkout(self, rev_id, checkout_dir=None):
367
380
        """Get a new tree, with the specified revision in it.
368
381
        """