~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_win32utils.py

  • Committer: Martin
  • Date: 2010-06-22 00:32:37 UTC
  • mto: This revision was merged to the branch mainline in revision 5315.
  • Revision ID: gzlist@googlemail.com-20100622003237-zntnpyx8hjb5jnpw
Change interface of _command_line_to_argv so old tests can still be used with new stripping logic

Show diffs side-by-side

added added

removed removed

Lines of Context:
276
276
 
277
277
class Test_CommandLineToArgv(tests.TestCaseInTempDir):
278
278
 
279
 
    def assertCommandLine(self, expected, line, single_quotes_allowed=False):
 
279
    def assertCommandLine(self, expected, line, argv=None,
 
280
            single_quotes_allowed=False):
280
281
        # Strictly speaking we should respect parameter order versus glob
281
282
        # expansions, but it's not really worth the effort here
282
 
        argv = win32utils._command_line_to_argv(line,
 
283
        if argv is None:
 
284
            argv = [line]
 
285
        argv = win32utils._command_line_to_argv(line, argv,
283
286
                single_quotes_allowed=single_quotes_allowed)
284
287
        self.assertEqual(expected, sorted(argv))
285
288
 
313
316
 
314
317
    def test_single_quote_support(self):
315
318
        self.assertCommandLine(["add", "let's-do-it.txt"],
316
 
            "add let's-do-it.txt")
317
 
        self.assertCommandLine(["add", "lets do it.txt"],
318
 
            "add 'lets do it.txt'", single_quotes_allowed=True)
 
319
            "add let's-do-it.txt",
 
320
            ["add", "let's-do-it.txt"])
 
321
        self.expectFailure("Using single quotes breaks trimming from argv",
 
322
            self.assertCommandLine, ["add", "lets do it.txt"],
 
323
            "add 'lets do it.txt'", ["add", "'lets", "do", "it.txt'"],
 
324
            single_quotes_allowed=True)
319
325
 
320
326
    def test_case_insensitive_globs(self):
321
327
        self.requireFeature(tests.CaseInsCasePresFilenameFeature)