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')],
71
self.assertAsTokens([(False, u'a'), (True, u''), (False, u'c')],
72
u"a '' c", single_quotes_allowed=True)
68
74
def test_unicode_chars(self):
69
75
self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],
92
98
self.assertAsTokens([(True, u'x x'), (True, u'y y')],
93
99
u'"x x" \'y y\'', single_quotes_allowed=True)
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')],
119
self.assertAsTokens([(True, u'\\\\')], u'"\\\\')