~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

  • Committer: John Whitley
  • Date: 2010-01-11 16:44:02 UTC
  • mto: This revision was merged to the branch mainline in revision 4981.
  • Revision ID: whitley@bangpath.org-20100111164402-9luag9p9ahpy4kmz
Terminology change: exclusion => exception.
Tweaked presentation of new logic in ExceptionGlobster

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from bzrlib.globbing import (
19
19
    Globster,
20
 
    ExcludingGlobster,
 
20
    ExceptionGlobster,
21
21
    _OrderedGlobster,
22
22
    normalize_pattern
23
23
    )
308
308
            self.assertEqual(patterns[x],globster.match(filename))
309
309
        self.assertEqual(None,globster.match('foobar.300'))
310
310
 
311
 
class TestExcludingGlobster(TestCase):
 
311
class TestExceptionGlobster(TestCase):
312
312
 
313
313
    def test_exclusion_patterns(self):
314
 
        """test that exclusion patterns are not matched"""
 
314
        """test that exception patterns are not matched"""
315
315
        patterns = [ u'*', u'!./local', u'!./local/**/*', u'!RE:\.z.*',u'!!./.zcompdump' ]
316
 
        globster = ExcludingGlobster(patterns)
 
316
        globster = ExceptionGlobster(patterns)
317
317
        self.assertEqual(u'*', globster.match('tmp/foo.txt'))
318
318
        self.assertEqual(None, globster.match('local'))
319
319
        self.assertEqual(None, globster.match('local/bin/wombat'))
324
324
    def test_exclusion_order(self):
325
325
        """test that ordering of exclusion patterns does not matter"""
326
326
        patterns = [ u'static/**/*.html', u'!static/**/versionable.html']
327
 
        globster = ExcludingGlobster(patterns)
 
327
        globster = ExceptionGlobster(patterns)
328
328
        self.assertEqual(u'static/**/*.html', globster.match('static/foo.html'))
329
329
        self.assertEqual(None, globster.match('static/versionable.html'))
330
330
        self.assertEqual(None, globster.match('static/bar/versionable.html'))
331
 
        globster = ExcludingGlobster(reversed(patterns))
 
331
        globster = ExceptionGlobster(reversed(patterns))
332
332
        self.assertEqual(u'static/**/*.html', globster.match('static/foo.html'))
333
333
        self.assertEqual(None, globster.match('static/versionable.html'))
334
334
        self.assertEqual(None, globster.match('static/bar/versionable.html'))