~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_cmdline.py

  • Committer: Patch Queue Manager
  • Date: 2015-04-21 05:32:33 UTC
  • mfrom: (6602.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20150421053233-x63rhby1q3612v2h
(richard-wilbur) (jelmer)Make bzr build reproducible for Debian. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from bzrlib import (
19
19
    cmdline,
20
 
    tests)
 
20
    tests,
 
21
    )
 
22
from bzrlib.tests.features import backslashdir_feature
21
23
 
22
24
class TestSplitter(tests.TestCase):
23
25
 
64
66
        self.assertAsTokens([(True, '')], u'""')
65
67
        self.assertAsTokens([(False, u"''")], u"''")
66
68
        self.assertAsTokens([(True, '')], u"''", single_quotes_allowed=True)
 
69
        self.assertAsTokens([(False, u'a'), (True, u''), (False, u'c')],
 
70
                            u'a "" c')
 
71
        self.assertAsTokens([(False, u'a'), (True, u''), (False, u'c')],
 
72
                            u"a '' c", single_quotes_allowed=True)
67
73
 
68
74
    def test_unicode_chars(self):
69
75
        self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],
91
97
            u'"x x" "y y"')
92
98
        self.assertAsTokens([(True, u'x x'), (True, u'y y')],
93
99
            u'"x x" \'y y\'', single_quotes_allowed=True)
 
100
 
 
101
    def test_n_backslashes_handling(self):
 
102
        # https://bugs.launchpad.net/bzr/+bug/528944
 
103
        # actually we care about the doubled backslashes when they're
 
104
        # represents UNC paths.
 
105
        # But in fact there is too much weird corner cases
 
106
        # (see https://bugs.launchpad.net/tortoisebzr/+bug/569050)
 
107
        # so to reproduce every bit of windows command-line handling
 
108
        # could be not worth of efforts?
 
109
        self.requireFeature(backslashdir_feature)
 
110
        self.assertAsTokens([(True, r'\\host\path')], r'"\\host\path"')
 
111
        self.assertAsTokens([(False, r'\\host\path')], r'\\host\path')
 
112
        # handling of " after the 2n and 2n+1 backslashes
 
113
        # inside and outside the quoted string
 
114
        self.assertAsTokens([(True, r'\\'), (False, r'*.py')], r'"\\\\" *.py')
 
115
        self.assertAsTokens([(True, r'\\" *.py')], r'"\\\\\" *.py"')
 
116
        self.assertAsTokens([(True, r'\\ *.py')], r'\\\\" *.py"')
 
117
        self.assertAsTokens([(False, r'\\"'), (False, r'*.py')],
 
118
                            r'\\\\\" *.py')
 
119
        self.assertAsTokens([(True, u'\\\\')], u'"\\\\')