~bzr-pqm/bzr/bzr.dev

2617.5.4 by Kuno Meyer
Included feedback on initial patch.
1
# Copyright (C) 2007 Canonical Ltd
2617.5.1 by Kuno Meyer
Added direct unit tests for win32utils.glob_expand().
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2617.5.1 by Kuno Meyer
Added direct unit tests for win32utils.glob_expand().
16
2681.4.2 by Alexander Belchenko
test for get_app_path
17
import os
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
18
import sys
19
4786.1.1 by John Arbash Meinel
Work on doing globbing, etc for all commands on Windows.
20
from bzrlib import (
21
    osutils,
22
    tests,
23
    win32utils,
24
    )
4505.2.4 by Alexander Belchenko
guard tests with UnicodeFilenameFeature.
25
from bzrlib.tests import (
26
    Feature,
27
    TestCase,
28
    TestCaseInTempDir,
29
    TestSkipped,
30
    UnicodeFilenameFeature,
31
    )
2681.4.2 by Alexander Belchenko
test for get_app_path
32
from bzrlib.win32utils import glob_expand, get_app_path
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
33
34
35
# Features
36
# --------
37
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
38
class _NeedsGlobExpansionFeature(Feature):
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
39
40
    def _probe(self):
2617.5.5 by Kuno Meyer
Just a typo remained from testing.
41
        return sys.platform == 'win32'
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
42
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
43
    def feature_name(self):
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
44
        return 'Internally performed glob expansion'
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
45
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
46
NeedsGlobExpansionFeature = _NeedsGlobExpansionFeature()
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
47
48
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
49
class _RequiredModuleFeature(Feature):
50
51
    def __init__(self, mod_name):
52
        self.mod_name = mod_name
53
        super(_RequiredModuleFeature, self).__init__()
2681.4.4 by Alexander Belchenko
test use Feature instead of TestSkipped
54
55
    def _probe(self):
56
        try:
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
57
            __import__(self.mod_name)
2681.4.4 by Alexander Belchenko
test use Feature instead of TestSkipped
58
            return True
59
        except ImportError:
60
            return False
61
62
    def feature_name(self):
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
63
        return self.mod_name
2681.4.4 by Alexander Belchenko
test use Feature instead of TestSkipped
64
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
65
Win32RegistryFeature = _RequiredModuleFeature('_winreg')
66
CtypesFeature = _RequiredModuleFeature('ctypes')
67
Win32comShellFeature = _RequiredModuleFeature('win32com.shell')
2681.4.4 by Alexander Belchenko
test use Feature instead of TestSkipped
68
69
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
70
# Tests
71
# -----
2617.5.6 by Kuno Meyer
Incorporated feedback from the mailinglist.
72
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
73
class TestNeedsGlobExpansionFeature(TestCase):
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
74
2617.5.6 by Kuno Meyer
Incorporated feedback from the mailinglist.
75
    def test_available(self):
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
76
        self.assertEqual(sys.platform == 'win32',
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
77
                         NeedsGlobExpansionFeature.available())
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
78
2617.5.6 by Kuno Meyer
Incorporated feedback from the mailinglist.
79
    def test_str(self):
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
80
        self.assertTrue("performed" in str(NeedsGlobExpansionFeature))
2617.5.6 by Kuno Meyer
Incorporated feedback from the mailinglist.
81
82
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
83
class TestWin32UtilsGlobExpand(TestCaseInTempDir):
2617.5.2 by Kuno Meyer
just reformatting
84
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
85
    _test_needs_features = [NeedsGlobExpansionFeature]
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
86
2617.5.1 by Kuno Meyer
Added direct unit tests for win32utils.glob_expand().
87
    def test_empty_tree(self):
88
        self.build_tree([])
2617.5.2 by Kuno Meyer
just reformatting
89
        self._run_testset([
90
            [['a'], ['a']],
91
            [['?'], ['?']],
92
            [['*'], ['*']],
93
            [['a', 'a'], ['a', 'a']]])
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
94
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
95
    def test_tree_ascii(self):
2617.5.7 by Kuno Meyer
Fix for non-ASCII filenames
96
        """Checks the glob expansion and path separation char
97
        normalization"""
2617.5.1 by Kuno Meyer
Added direct unit tests for win32utils.glob_expand().
98
        self.build_tree(['a', 'a1', 'a2', 'a11', 'a.1',
99
                         'b', 'b1', 'b2', 'b3',
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
100
                         'c/', 'c/c1', 'c/c2',
2617.5.4 by Kuno Meyer
Included feedback on initial patch.
101
                         'd/', 'd/d1', 'd/d2', 'd/e/', 'd/e/e1'])
2617.5.2 by Kuno Meyer
just reformatting
102
        self._run_testset([
103
            # no wildcards
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
104
            [[u'a'], [u'a']],
105
            [[u'a', u'a' ], [u'a', u'a']],
106
            [[u'A'], [u'A']],
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
107
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
108
            [[u'd'], [u'd']],
109
            [[u'd/'], [u'd/']],
110
            [[u'd\\'], [u'd/']],
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
111
2617.5.2 by Kuno Meyer
just reformatting
112
            # wildcards
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
113
            [[u'a*'], [u'a', u'a1', u'a2', u'a11', u'a.1']],
114
            [[u'?'], [u'a', u'b', u'c', u'd']],
115
            [[u'a?'], [u'a1', u'a2']],
116
            [[u'a??'], [u'a11', u'a.1']],
117
            [[u'b[1-2]'], [u'b1', u'b2']],
118
            [[u'A?'], [u'a1', u'a2']],
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
119
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
120
            [[u'd/*'], [u'd/d1', u'd/d2', u'd/e']],
121
            [[u'd\\*'], [u'd/d1', u'd/d2', u'd/e']],
122
            [[u'?\\*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
123
            [[u'*\\*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
124
            [[u'*/'], [u'c/', u'd/']],
125
            [[u'*\\'], [u'c/', u'd/']]])
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
126
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
127
    def test_tree_unicode(self):
2617.5.7 by Kuno Meyer
Fix for non-ASCII filenames
128
        """Checks behaviour with non-ascii filenames"""
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
129
        self.build_tree([u'\u1234', u'\u1234\u1234', u'\u1235/', u'\u1235/\u1235'])
2617.5.7 by Kuno Meyer
Fix for non-ASCII filenames
130
        self._run_testset([
131
            # no wildcards
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
132
            [[u'\u1234'], [u'\u1234']],
133
            [[u'\u1235'], [u'\u1235']],
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
134
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
135
            [[u'\u1235/'], [u'\u1235/']],
136
            [[u'\u1235/\u1235'], [u'\u1235/\u1235']],
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
137
2617.5.7 by Kuno Meyer
Fix for non-ASCII filenames
138
            # wildcards
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
139
            [[u'?'], [u'\u1234', u'\u1235']],
140
            [[u'*'], [u'\u1234', u'\u1234\u1234', u'\u1235']],
141
            [[u'\u1234*'], [u'\u1234', u'\u1234\u1234']],
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
142
2617.5.8 by Kuno Meyer
Extended tests for unicode chars outside of the iso-8859-* range
143
            [[u'\u1235/?'], [u'\u1235/\u1235']],
144
            [[u'\u1235/*'], [u'\u1235/\u1235']],
145
            [[u'\u1235\\?'], [u'\u1235/\u1235']],
146
            [[u'\u1235\\*'], [u'\u1235/\u1235']],
147
            [[u'?/'], [u'\u1235/']],
148
            [[u'*/'], [u'\u1235/']],
149
            [[u'?\\'], [u'\u1235/']],
150
            [[u'*\\'], [u'\u1235/']],
151
            [[u'?/?'], [u'\u1235/\u1235']],
152
            [[u'*/*'], [u'\u1235/\u1235']],
153
            [[u'?\\?'], [u'\u1235/\u1235']],
154
            [[u'*\\*'], [u'\u1235/\u1235']]])
2617.5.7 by Kuno Meyer
Fix for non-ASCII filenames
155
2617.5.1 by Kuno Meyer
Added direct unit tests for win32utils.glob_expand().
156
    def _run_testset(self, testset):
157
        for pattern, expected in testset:
158
            result = glob_expand(pattern)
159
            expected.sort()
160
            result.sort()
161
            self.assertEqual(expected, result, 'pattern %s' % pattern)
2617.5.2 by Kuno Meyer
just reformatting
162
2681.4.2 by Alexander Belchenko
test for get_app_path
163
164
class TestAppPaths(TestCase):
165
2681.4.4 by Alexander Belchenko
test use Feature instead of TestSkipped
166
    _test_needs_features = [Win32RegistryFeature]
167
2681.4.2 by Alexander Belchenko
test for get_app_path
168
    def test_iexplore(self):
169
        # typical windows users should have IE installed
170
        for a in ('iexplore', 'iexplore.exe'):
171
            p = get_app_path(a)
172
            d, b = os.path.split(p)
3146.4.9 by Aaron Bentley
do case-insensitive comparision of iexplore filename
173
            self.assertEquals('iexplore.exe', b.lower())
2681.4.2 by Alexander Belchenko
test for get_app_path
174
            self.assertNotEquals('', d)
175
4476.2.1 by Alexander Belchenko
win32utils.py: get_app_path() can read path for wordpad.exe (data type_id is REG_EXPAND_SZ).
176
    def test_wordpad(self):
177
        # typical windows users should have wordpad in the system
178
        # but there is problem: its path has the format REG_EXPAND_SZ
179
        # so naive attempt to get the path is not working
180
        for a in ('wordpad', 'wordpad.exe'):
181
            p = get_app_path(a)
182
            d, b = os.path.split(p)
183
            self.assertEquals('wordpad.exe', b.lower())
184
            self.assertNotEquals('', d)
185
2681.4.2 by Alexander Belchenko
test for get_app_path
186
    def test_not_existing(self):
187
        p = get_app_path('not-existing')
188
        self.assertEquals('not-existing', p)
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
189
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
190
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
191
class TestLocationsCtypes(TestCase):
192
193
    _test_needs_features = [CtypesFeature]
194
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
195
    def assertPathsEqual(self, p1, p2):
196
        # TODO: The env var values in particular might return the "short"
197
        # version (ie, "C:\DOCUME~1\...").  Its even possible the returned
198
        # values will differ only by case - handle these situations as we
199
        # come across them.
200
        self.assertEquals(p1, p2)
201
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
202
    def test_appdata_not_using_environment(self):
203
        # Test that we aren't falling back to the environment
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
204
        first = win32utils.get_appdata_location()
205
        self._captureVar("APPDATA", None)
206
        self.assertPathsEqual(first, win32utils.get_appdata_location())
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
207
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
208
    def test_appdata_matches_environment(self):
209
        # Typically the APPDATA environment variable will match
210
        # get_appdata_location
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
211
        # XXX - See bug 262874, which asserts the correct encoding is 'mbcs',
212
        encoding = osutils.get_user_encoding()
3638.4.6 by Mark Hammond
Skip the environment checks when APPDATA isn't in the environment.
213
        env_val = os.environ.get("APPDATA", None)
214
        if not env_val:
215
            raise TestSkipped("No APPDATA environment variable exists")
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
216
        self.assertPathsEqual(win32utils.get_appdata_location(),
3638.4.6 by Mark Hammond
Skip the environment checks when APPDATA isn't in the environment.
217
                              env_val.decode(encoding))
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
218
219
    def test_local_appdata_not_using_environment(self):
220
        # Test that we aren't falling back to the environment
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
221
        first = win32utils.get_local_appdata_location()
222
        self._captureVar("LOCALAPPDATA", None)
223
        self.assertPathsEqual(first, win32utils.get_local_appdata_location())
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
224
225
    def test_local_appdata_matches_environment(self):
226
        # LOCALAPPDATA typically only exists on Vista, so we only attempt to
227
        # compare when it exists.
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
228
        lad = win32utils.get_local_appdata_location()
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
229
        env = os.environ.get("LOCALAPPDATA")
230
        if env:
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
231
            # XXX - See bug 262874, which asserts the correct encoding is 'mbcs'
232
            encoding = osutils.get_user_encoding()
233
            self.assertPathsEqual(lad, env.decode(encoding))
234
235
236
class TestLocationsPywin32(TestLocationsCtypes):
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
237
238
    _test_needs_features = [Win32comShellFeature]
239
240
    def setUp(self):
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
241
        super(TestLocationsPywin32, self).setUp()
242
        # We perform the exact same tests after disabling the use of ctypes.
243
        # This causes the implementation to fall back to pywin32.
244
        self.old_ctypes = win32utils.has_ctypes
245
        win32utils.has_ctypes = False
3638.4.1 by Mark Hammond
Add win32utils.get_local_appdata_location() so bzr and plugins can
246
        self.addCleanup(self.restoreCtypes)
247
248
    def restoreCtypes(self):
3638.4.3 by Mark Hammond
cleanup tests, rationalize path checking etc.
249
        win32utils.has_ctypes = self.old_ctypes
4505.2.1 by Alexander Belchenko
Set hidden attribute on .bzr directory below unicode path should never fail with error. The operation should succeed even if bzr unable to set the attribute. (related to bug #335362).
250
251
252
class TestSetHidden(TestCaseInTempDir):
253
4505.2.3 by Alexander Belchenko
added direct test for absolute path.
254
    def test_unicode_dir(self):
255
        # we should handle unicode paths without errors
4505.2.4 by Alexander Belchenko
guard tests with UnicodeFilenameFeature.
256
        self.requireFeature(UnicodeFilenameFeature)
4505.2.3 by Alexander Belchenko
added direct test for absolute path.
257
        os.mkdir(u'\u1234')
258
        win32utils.set_file_attr_hidden(u'\u1234')
259
260
    def test_dot_bzr_in_unicode_dir(self):
4505.2.1 by Alexander Belchenko
Set hidden attribute on .bzr directory below unicode path should never fail with error. The operation should succeed even if bzr unable to set the attribute. (related to bug #335362).
261
        # we should not raise traceback if we try to set hidden attribute
262
        # on .bzr directory below unicode path
4505.2.4 by Alexander Belchenko
guard tests with UnicodeFilenameFeature.
263
        self.requireFeature(UnicodeFilenameFeature)
4505.2.3 by Alexander Belchenko
added direct test for absolute path.
264
        os.makedirs(u'\u1234\\.bzr')
265
        path = osutils.abspath(u'\u1234\\.bzr')
266
        win32utils.set_file_attr_hidden(path)
4786.1.1 by John Arbash Meinel
Work on doing globbing, etc for all commands on Windows.
267
268
269
270
class TestUnicodeShlex(tests.TestCase):
271
272
    def assertAsTokens(self, expected, line):
273
        s = win32utils.UnicodeShlex(line)
274
        self.assertEqual(expected, list(s))
275
276
    def test_simple(self):
277
        self.assertAsTokens([(False, u'foo'), (False, u'bar'), (False, u'baz')],
278
                            u'foo bar baz')
279
280
    def test_ignore_multiple_spaces(self):
281
        self.assertAsTokens([(False, u'foo'), (False, u'bar')], u'foo  bar')
282
283
    def test_ignore_leading_space(self):
284
        self.assertAsTokens([(False, u'foo'), (False, u'bar')], u'  foo bar')
285
286
    def test_ignore_trailing_space(self):
287
        self.assertAsTokens([(False, u'foo'), (False, u'bar')], u'foo bar  ')
288
289
    def test_posix_quotations(self):
290
        self.assertAsTokens([(True, u'foo bar')], u'"foo bar"')
4789.1.1 by Alexander Belchenko
In standard windows shell single quote is not supported as quote. Restored standard windows behavior.
291
        self.assertAsTokens([(False, u"'fo''o"), (False, u"b''ar'")],
292
            u"'fo''o b''ar'")
4786.1.1 by John Arbash Meinel
Work on doing globbing, etc for all commands on Windows.
293
        self.assertAsTokens([(True, u'foo bar')], u'"fo""o b""ar"')
4789.1.1 by Alexander Belchenko
In standard windows shell single quote is not supported as quote. Restored standard windows behavior.
294
        self.assertAsTokens([(True, u"fo'o"), (True, u"b'ar")],
295
            u'"fo"\'o b\'"ar"')
4786.1.1 by John Arbash Meinel
Work on doing globbing, etc for all commands on Windows.
296
297
    def test_nested_quotations(self):
4789.1.1 by Alexander Belchenko
In standard windows shell single quote is not supported as quote. Restored standard windows behavior.
298
        self.assertAsTokens([(True, u'foo"" bar')], u"\"foo\\\"\\\" bar\"")
4786.1.1 by John Arbash Meinel
Work on doing globbing, etc for all commands on Windows.
299
        self.assertAsTokens([(True, u'foo\'\' bar')], u"\"foo'' bar\"")
300
301
    def test_empty_result(self):
302
        self.assertAsTokens([], u'')
303
        self.assertAsTokens([], u'    ')
304
305
    def test_quoted_empty(self):
306
        self.assertAsTokens([(True, '')], u'""')
4789.1.1 by Alexander Belchenko
In standard windows shell single quote is not supported as quote. Restored standard windows behavior.
307
        self.assertAsTokens([(False, u"''")], u"''")
4786.1.1 by John Arbash Meinel
Work on doing globbing, etc for all commands on Windows.
308
309
    def test_unicode_chars(self):
310
        self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],
311
                             u'f\xb5\xee \u1234\u3456')
312
313
    def test_newline_in_quoted_section(self):
314
        self.assertAsTokens([(True, u'foo\nbar\nbaz\n')], u'"foo\nbar\nbaz\n"')
315
316
    def test_escape_chars(self):
317
        self.assertAsTokens([(False, u'foo\\bar')], u'foo\\bar')
318
319
    def test_escape_quote(self):
320
        self.assertAsTokens([(True, u'foo"bar')], u'"foo\\"bar"')
321
322
    def test_double_escape(self):
323
        self.assertAsTokens([(True, u'foo\\bar')], u'"foo\\\\bar"')
324
        self.assertAsTokens([(False, u'foo\\\\bar')], u"foo\\\\bar")
325
326
327
class Test_CommandLineToArgv(tests.TestCaseInTempDir):
328
329
    def assertCommandLine(self, expected, line):
330
        self.assertEqual(expected, win32utils._command_line_to_argv(line))
331
332
    def test_glob_paths(self):
333
        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
334
        self.assertCommandLine([u'a/b.c', u'a/c.c'], 'a/*.c')
335
        self.build_tree(['b/', 'b/b.c', 'b/d.c', 'b/d.h'])
336
        self.assertCommandLine([u'a/b.c', u'b/b.c'], '*/b.c')
337
        self.assertCommandLine([u'a/b.c', u'a/c.c', u'b/b.c', u'b/d.c'],
338
                               '*/*.c')
339
        # Bash style, just pass through the argument if nothing matches
340
        self.assertCommandLine([u'*/*.qqq'], '*/*.qqq')
341
342
    def test_quoted_globs(self):
343
        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
344
        self.assertCommandLine([u'a/*.c'], '"a/*.c"')
4789.1.1 by Alexander Belchenko
In standard windows shell single quote is not supported as quote. Restored standard windows behavior.
345
        self.assertCommandLine([u"'a/*.c'"], "'a/*.c'")
4786.1.2 by John Arbash Meinel
Refactor the glob_expand code a bit, making the inner function more reusable.
346
347
    def test_slashes_changed(self):
348
        self.assertCommandLine([u'a/*.c'], '"a\\*.c"')
349
        # Expands the glob, but nothing matches
350
        self.assertCommandLine([u'a/*.c'], 'a\\*.c')
351
        self.assertCommandLine([u'a/foo.c'], 'a\\foo.c')
4789.1.1 by Alexander Belchenko
In standard windows shell single quote is not supported as quote. Restored standard windows behavior.
352
353
    def test_no_single_quote_supported(self):
354
        self.assertCommandLine(["add", "let's-do-it.txt"],
355
            "add let's-do-it.txt")