~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

(parthm) Better regex compile errors (Parth Malwankar)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
17
17
 
 
18
from bzrlib import errors
18
19
from bzrlib.globbing import (
19
20
    Globster,
20
21
    ExceptionGlobster,
308
309
            self.assertEqual(patterns[x],globster.match(filename))
309
310
        self.assertEqual(None,globster.match('foobar.300'))
310
311
 
 
312
    def test_bad_pattern(self):
 
313
        """Ensure that globster handles bad patterns cleanly."""
 
314
        patterns = [u'RE:[']
 
315
        g = Globster(patterns)
 
316
        e = self.assertRaises(errors.InvalidPattern, g.match, 'foo')
 
317
        self.assertContainsRe(e.message, "File.*ignore.*contains errors")
 
318
 
 
319
 
311
320
class TestExceptionGlobster(TestCase):
312
321
 
313
322
    def test_exclusion_patterns(self):