~bzr/ubuntu/lucid/bzr/beta-ppa

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

  • Committer: Martin Pool
  • Date: 2010-08-18 04:26:39 UTC
  • mfrom: (129.1.8 packaging-karmic)
  • Revision ID: mbp@sourcefrog.net-20100818042639-mjoxtngyjwiu05fo
* PPA rebuild for lucid.
* PPA rebuild for karmic.
* PPA rebuild onto jaunty.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
 
18
import re
 
19
 
 
20
from bzrlib import errors
18
21
from bzrlib.globbing import (
19
22
    Globster,
20
23
    ExceptionGlobster,
308
311
            self.assertEqual(patterns[x],globster.match(filename))
309
312
        self.assertEqual(None,globster.match('foobar.300'))
310
313
 
 
314
    def test_bad_pattern(self):
 
315
        """Ensure that globster handles bad patterns cleanly."""
 
316
        patterns = [u'RE:[', u'/home/foo', u'RE:*.cpp']
 
317
        g = Globster(patterns)
 
318
        e = self.assertRaises(errors.InvalidPattern, g.match, 'filename')
 
319
        self.assertContainsRe(e.msg,
 
320
            "File.*ignore.*contains error.*RE:\[.*RE:\*\.cpp", flags=re.DOTALL)
 
321
 
 
322
 
311
323
class TestExceptionGlobster(TestCase):
312
324
 
313
325
    def test_exclusion_patterns(self):