~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

  • Committer: Andrew Bennetts
  • Date: 2008-07-28 06:53:44 UTC
  • mfrom: (3581 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3583.
  • Revision ID: andrew.bennetts@canonical.com-20080728065344-ocndjoycs903q6fz
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from bzrlib.globbing import (
19
19
    Globster,
 
20
    _OrderedGlobster,
20
21
    )
21
22
from bzrlib.tests import (
22
23
    TestCase, 
305
306
            self.assertEqual(patterns[x],globster.match(filename))
306
307
        self.assertEqual(None,globster.match('foobar.300'))
307
308
 
 
309
 
 
310
class TestOrderedGlobster(TestCase):
 
311
 
 
312
    def test_ordered_globs(self):
 
313
        """test that the first match in a list is the one found"""
 
314
        patterns = [ u'*.foo', u'bar.*']
 
315
        globster = _OrderedGlobster(patterns)
 
316
        self.assertEqual(u'*.foo', globster.match('bar.foo'))
 
317
        self.assertEqual(None, globster.match('foo.bar'))
 
318
        globster = _OrderedGlobster(reversed(patterns))
 
319
        self.assertEqual(u'bar.*', globster.match('bar.foo'))
 
320
        self.assertEqual(None, globster.match('foo.bar'))