/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-31 17:42:29 UTC
  • mto: This revision was merged to the branch mainline in revision 4611.
  • Revision ID: john@arbash-meinel.com-20090731174229-w2zdsdlfpeddk8gl
Now we got to the per-workingtree tests, etc.

The main causes seem to break down into:
  bzrdir.clone() is known to be broken wrt locking, this effects
  everything that tries to 'push'

  shelf code is not compatible with strict locking

  merge code seems to have an issue. This might actually be the
  root cause of the clone() problems.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
17
17
 
18
18
from bzrlib.globbing import (
19
19
    Globster,
20
 
    ExceptionGlobster,
21
20
    _OrderedGlobster,
22
 
    normalize_pattern
23
21
    )
24
22
from bzrlib.tests import (
25
23
    TestCase,
308
306
            self.assertEqual(patterns[x],globster.match(filename))
309
307
        self.assertEqual(None,globster.match('foobar.300'))
310
308
 
311
 
class TestExceptionGlobster(TestCase):
312
 
 
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'))
323
 
 
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'))
335
309
 
336
310
class TestOrderedGlobster(TestCase):
337
311
 
344
318
        globster = _OrderedGlobster(reversed(patterns))
345
319
        self.assertEqual(u'bar.*', globster.match('bar.foo'))
346
320
        self.assertEqual(None, globster.match('foo.bar'))
347
 
 
348
 
 
349
 
class TestNormalizePattern(TestCase):
350
 
 
351
 
    def test_backslashes(self):
352
 
        """tests that backslashes are converted to forward slashes, multiple
353
 
        backslashes are collapsed to single forward slashes and trailing
354
 
        backslashes are removed"""
355
 
        self.assertEqual(u'/', normalize_pattern(u'\\'))
356
 
        self.assertEqual(u'/', normalize_pattern(u'\\\\'))
357
 
        self.assertEqual(u'/foo/bar', normalize_pattern(u'\\foo\\bar'))
358
 
        self.assertEqual(u'foo/bar', normalize_pattern(u'foo\\bar\\'))
359
 
        self.assertEqual(u'/foo/bar', normalize_pattern(u'\\\\foo\\\\bar\\\\'))
360
 
 
361
 
    def test_forward_slashes(self):
362
 
        """tests that multiple foward slashes are collapsed to single forward
363
 
        slashes and trailing forward slashes are removed"""
364
 
        self.assertEqual(u'/', normalize_pattern(u'/'))
365
 
        self.assertEqual(u'/', normalize_pattern(u'//'))
366
 
        self.assertEqual(u'/foo/bar', normalize_pattern(u'/foo/bar'))
367
 
        self.assertEqual(u'foo/bar', normalize_pattern(u'foo/bar/'))
368
 
        self.assertEqual(u'/foo/bar', normalize_pattern(u'//foo//bar//'))
369
 
 
370
 
    def test_mixed_slashes(self):
371
 
        """tests that multiple mixed slashes are collapsed to single forward
372
 
        slashes and trailing mixed slashes are removed"""
373
 
        self.assertEqual(u'/foo/bar', normalize_pattern(u'\\/\\foo//\\///bar/\\\\/'))