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
20
from bzrlib import errors
21
18
from bzrlib.globbing import (
55
52
def test_char_group_digit(self):
56
53
self.assertMatchBasenameAndFullpath([
57
54
# The definition of digit this uses includes arabic digits from
58
# non-latin scripts (arabic, indic, etc.) but neither roman
59
# numerals nor vulgar fractions. Some characters such as
60
# subscript/superscript digits may or may not match depending on
61
# the Python version used, see: <http://bugs.python.org/issue6561>
55
# non-latin scripts (arabic, indic, etc.) and subscript/superscript
56
# digits, but neither roman numerals nor vulgar fractions.
63
[u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21'],
58
[u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21', u'\xb9'],
64
59
[u'T', u'q', u' ', u'\u8336', u'.']),
66
61
[u'T', u'q', u' ', u'\u8336', u'.'],
67
[u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21']),
62
[u'0', u'5', u'\u0663', u'\u06f9', u'\u0f21', u'\xb9']),
70
65
def test_char_group_space(self):
313
308
self.assertEqual(patterns[x],globster.match(filename))
314
309
self.assertEqual(None,globster.match('foobar.300'))
316
def test_bad_pattern(self):
317
"""Ensure that globster handles bad patterns cleanly."""
318
patterns = [u'RE:[', u'/home/foo', u'RE:*.cpp']
319
g = Globster(patterns)
320
e = self.assertRaises(errors.InvalidPattern, g.match, 'filename')
321
self.assertContainsRe(e.msg,
322
"File.*ignore.*contains error.*RE:\[.*RE:\*\.cpp", flags=re.DOTALL)
325
311
class TestExceptionGlobster(TestCase):
327
313
def test_exclusion_patterns(self):