~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_globbing.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
from bzrlib.globbing import (
19
19
    Globster,
20
20
    _OrderedGlobster,
21
21
    )
22
22
from bzrlib.tests import (
23
 
    TestCase, 
 
23
    TestCase,
24
24
    TestCaseInTempDir,
25
25
    )
26
26
 
171
171
             [u'foo/x', u'foo/bax', u'foo/a.x', u'foo/.x', u'foo/.q.x'],
172
172
             [u'foo/bar/bax']),
173
173
            (u'*/*x',
174
 
             [u'\u8336/x', u'foo/x', u'foo/bax', u'x/a.x', u'.foo/x', 
 
174
             [u'\u8336/x', u'foo/x', u'foo/bax', u'x/a.x', u'.foo/x',
175
175
              u'\u8336/.x', u'foo/.q.x'],
176
176
             [u'foo/bar/bax']),
177
177
            (u'f*',
178
178
             [u'foo', u'foo.bar'],
179
179
             [u'.foo', u'foo/bar', u'foo/.bar']),
180
180
            (u'*bar',
181
 
             [u'bar', u'foobar', ur'foo\nbar', u'foo.bar', u'foo/bar', 
 
181
             [u'bar', u'foobar', ur'foo\nbar', u'foo.bar', u'foo/bar',
182
182
              u'foo/foobar', u'foo/f.bar', u'.bar', u'foo/.bar'],
183
183
             []),
184
184
            ])
191
191
             [u'foox', u'foo/bax', u'foo/.x', u'foo/bar/bax']),
192
192
            (u'**/bar',
193
193
             [u'bar', u'foo/bar'],
194
 
             [u'foobar', u'foo.bar', u'foo/foobar', u'foo/f.bar', 
 
194
             [u'foobar', u'foo.bar', u'foo/foobar', u'foo/f.bar',
195
195
              u'.bar', u'foo/.bar']),
196
196
            # check that we ignore extra *s, so *** is treated like ** not *.
197
197
            (u'foo/***/x',
199
199
             [u'foox', u'foo/bax', u'foo/.x', u'foo/bar/bax']),
200
200
            (u'***/bar',
201
201
             [u'bar', u'foo/bar'],
202
 
             [u'foobar', u'foo.bar', u'foo/foobar', u'foo/f.bar', 
 
202
             [u'foobar', u'foo.bar', u'foo/foobar', u'foo/f.bar',
203
203
              u'.bar', u'foo/.bar']),
204
204
            # the remaining tests check that ** is interpreted as *
205
205
            # unless it is a whole path component
216
216
             [u'foo', u'foo.bar'],
217
217
             [u'.foo', u'foo/bar', u'foo/.bar']),
218
218
            (u'**bar',
219
 
             [u'bar', u'foobar', ur'foo\nbar', u'foo.bar', u'foo/bar', 
 
219
             [u'bar', u'foobar', ur'foo\nbar', u'foo.bar', u'foo/bar',
220
220
              u'foo/foobar', u'foo/f.bar', u'.bar', u'foo/.bar'],
221
221
             []),
222
222
            ])
257
257
    def test_leading_asterisk_dot(self):
258
258
        self.assertMatch([
259
259
            (u'*.x',
260
 
             [u'foo/bar/baz.x', u'\u8336/Q.x', u'foo.y.x', u'.foo.x', 
 
260
             [u'foo/bar/baz.x', u'\u8336/Q.x', u'foo.y.x', u'.foo.x',
261
261
              u'bar/.foo.x', u'.x',],
262
262
             [u'foo.x.y']),
263
263
            (u'foo/*.bar',
293
293
    def test_large_globset(self):
294
294
        """tests that the globster can handle a large set of patterns.
295
295
 
296
 
        Large is defined as more than supported by python regex groups, 
 
296
        Large is defined as more than supported by python regex groups,
297
297
        i.e. 99.
298
298
        This test assumes the globs are broken into regexs containing 99
299
299
        groups.