~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_win32utils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-11-08 01:16:25 UTC
  • mfrom: (4789.1.1 no-single-quote-on-win32)
  • Revision ID: pqm@pqm.ubuntu.com-20091108011625-5u4zuh77zbj10wz4
(bialix) Don't use ' as a quoting character in the new win32 parser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
288
288
 
289
289
    def test_posix_quotations(self):
290
290
        self.assertAsTokens([(True, u'foo bar')], u'"foo bar"')
291
 
        self.assertAsTokens([(True, u'foo bar')], u"'foo bar'")
292
 
        self.assertAsTokens([(True, u'foo bar')], u"'fo''o b''ar'")
 
291
        self.assertAsTokens([(False, u"'fo''o"), (False, u"b''ar'")],
 
292
            u"'fo''o b''ar'")
293
293
        self.assertAsTokens([(True, u'foo bar')], u'"fo""o b""ar"')
294
 
        self.assertAsTokens([(True, u'foo bar')], u'"fo"\'o b\'"ar"')
 
294
        self.assertAsTokens([(True, u"fo'o"), (True, u"b'ar")],
 
295
            u'"fo"\'o b\'"ar"')
295
296
 
296
297
    def test_nested_quotations(self):
297
 
        self.assertAsTokens([(True, u'foo"" bar')], u"'foo\"\" bar'")
 
298
        self.assertAsTokens([(True, u'foo"" bar')], u"\"foo\\\"\\\" bar\"")
298
299
        self.assertAsTokens([(True, u'foo\'\' bar')], u"\"foo'' bar\"")
299
300
 
300
301
    def test_empty_result(self):
303
304
 
304
305
    def test_quoted_empty(self):
305
306
        self.assertAsTokens([(True, '')], u'""')
306
 
        self.assertAsTokens([(True, '')], u"''")
 
307
        self.assertAsTokens([(False, u"''")], u"''")
307
308
 
308
309
    def test_unicode_chars(self):
309
310
        self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],
311
312
 
312
313
    def test_newline_in_quoted_section(self):
313
314
        self.assertAsTokens([(True, u'foo\nbar\nbaz\n')], u'"foo\nbar\nbaz\n"')
314
 
        self.assertAsTokens([(True, u'foo\nbar\nbaz\n')], u"'foo\nbar\nbaz\n'")
315
315
 
316
316
    def test_escape_chars(self):
317
317
        self.assertAsTokens([(False, u'foo\\bar')], u'foo\\bar')
318
318
 
319
319
    def test_escape_quote(self):
320
320
        self.assertAsTokens([(True, u'foo"bar')], u'"foo\\"bar"')
321
 
        self.assertAsTokens([(True, u'foo\\"bar')], u"'foo\\\"bar'")
322
321
 
323
322
    def test_double_escape(self):
324
323
        self.assertAsTokens([(True, u'foo\\bar')], u'"foo\\\\bar"')
325
 
        self.assertAsTokens([(True, u'foo\\\\bar')], u"'foo\\\\bar'")
326
324
        self.assertAsTokens([(False, u'foo\\\\bar')], u"foo\\\\bar")
327
325
 
328
326
 
344
342
    def test_quoted_globs(self):
345
343
        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
346
344
        self.assertCommandLine([u'a/*.c'], '"a/*.c"')
347
 
        self.assertCommandLine([u'a/*.c'], "'a/*.c'")
 
345
        self.assertCommandLine([u"'a/*.c'"], "'a/*.c'")
348
346
 
349
347
    def test_slashes_changed(self):
350
348
        self.assertCommandLine([u'a/*.c'], '"a\\*.c"')
351
349
        # Expands the glob, but nothing matches
352
350
        self.assertCommandLine([u'a/*.c'], 'a\\*.c')
353
351
        self.assertCommandLine([u'a/foo.c'], 'a\\foo.c')
 
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")