/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_osutils.py

  • Committer: Martin Pool
  • Date: 2009-03-24 01:43:50 UTC
  • mto: This revision was merged to the branch mainline in revision 4192.
  • Revision ID: mbp@sourcefrog.net-20090324014350-z4qg62nv8ly1sox1
SeparateĀ outĀ re_compile_checked

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from cStringIO import StringIO
20
20
import errno
21
21
import os
 
22
import re
22
23
import socket
23
24
import stat
24
25
import sys
1525
1526
            'yyy.xx')
1526
1527
        # test unknown resource
1527
1528
        self.assertRaises(IOError, osutils.resource_string, 'bzrlib', 'yyy.xx')
 
1529
 
 
1530
 
 
1531
class TestReCompile(TestCase):
 
1532
 
 
1533
    def test_re_compile_checked(self):
 
1534
        r = osutils.re_compile_checked(r'A*', re.IGNORECASE)
 
1535
        self.assertTrue(r.match('aaaa'))
 
1536
        self.assertTrue(r.match('aAaA'))
 
1537
 
 
1538
    def test_re_compile_checked_error(self):
 
1539
        # like https://bugs.launchpad.net/bzr/+bug/251352
 
1540
        err = self.assertRaises(
 
1541
            errors.BzrCommandError,
 
1542
            osutils.re_compile_checked, '*', re.IGNORECASE, 'test case')
 
1543
        self.assertEqual(
 
1544
            "Invalid regular expression in test case: '*': "
 
1545
            "nothing to repeat",
 
1546
            str(err))