307
308
self.assertEqual(patterns[x],globster.match(filename))
308
309
self.assertEqual(None,globster.match('foobar.300'))
311
class TestExceptionGlobster(TestCase):
313
def test_exclusion_patterns(self):
314
"""test that exception patterns are not matched"""
315
patterns = [ u'*', u'!./local', u'!./local/**/*', u'!RE:\.z.*',u'!!./.zcompdump' ]
316
globster = ExceptionGlobster(patterns)
317
self.assertEqual(u'*', globster.match('tmp/foo.txt'))
318
self.assertEqual(None, globster.match('local'))
319
self.assertEqual(None, globster.match('local/bin/wombat'))
320
self.assertEqual(None, globster.match('.zshrc'))
321
self.assertEqual(None, globster.match('.zfunctions/fiddle/flam'))
322
self.assertEqual(u'!!./.zcompdump', globster.match('.zcompdump'))
324
def test_exclusion_order(self):
325
"""test that ordering of exclusion patterns does not matter"""
326
patterns = [ u'static/**/*.html', u'!static/**/versionable.html']
327
globster = ExceptionGlobster(patterns)
328
self.assertEqual(u'static/**/*.html', globster.match('static/foo.html'))
329
self.assertEqual(None, globster.match('static/versionable.html'))
330
self.assertEqual(None, globster.match('static/bar/versionable.html'))
331
globster = ExceptionGlobster(reversed(patterns))
332
self.assertEqual(u'static/**/*.html', globster.match('static/foo.html'))
333
self.assertEqual(None, globster.match('static/versionable.html'))
334
self.assertEqual(None, globster.match('static/bar/versionable.html'))
311
336
class TestOrderedGlobster(TestCase):