~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-02-23 17:00:36 UTC
  • mfrom: (4032.1.4 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090223170036-3q1v68ewdt8i0to5
(Marius Kruger) Remove all trailing whitespace and add tests to
        enforce this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
# -----
63
63
 
64
64
class TestNeedsGlobExpansionFeature(TestCase):
65
 
    
 
65
 
66
66
    def test_available(self):
67
 
        self.assertEqual(sys.platform == 'win32', 
 
67
        self.assertEqual(sys.platform == 'win32',
68
68
                         NeedsGlobExpansionFeature.available())
69
 
        
 
69
 
70
70
    def test_str(self):
71
71
        self.assertTrue("performed" in str(NeedsGlobExpansionFeature))
72
72
 
74
74
class TestWin32UtilsGlobExpand(TestCaseInTempDir):
75
75
 
76
76
    _test_needs_features = [NeedsGlobExpansionFeature]
77
 
   
 
77
 
78
78
    def test_empty_tree(self):
79
79
        self.build_tree([])
80
80
        self._run_testset([
82
82
            [['?'], ['?']],
83
83
            [['*'], ['*']],
84
84
            [['a', 'a'], ['a', 'a']]])
85
 
        
 
85
 
86
86
    def test_tree_ascii(self):
87
87
        """Checks the glob expansion and path separation char
88
88
        normalization"""
89
89
        self.build_tree(['a', 'a1', 'a2', 'a11', 'a.1',
90
90
                         'b', 'b1', 'b2', 'b3',
91
 
                         'c/', 'c/c1', 'c/c2', 
 
91
                         'c/', 'c/c1', 'c/c2',
92
92
                         'd/', 'd/d1', 'd/d2', 'd/e/', 'd/e/e1'])
93
93
        self._run_testset([
94
94
            # no wildcards
95
95
            [[u'a'], [u'a']],
96
96
            [[u'a', u'a' ], [u'a', u'a']],
97
97
            [[u'A'], [u'A']],
98
 
                
 
98
 
99
99
            [[u'd'], [u'd']],
100
100
            [[u'd/'], [u'd/']],
101
101
            [[u'd\\'], [u'd/']],
102
 
            
 
102
 
103
103
            # wildcards
104
104
            [[u'a*'], [u'a', u'a1', u'a2', u'a11', u'a.1']],
105
105
            [[u'?'], [u'a', u'b', u'c', u'd']],
107
107
            [[u'a??'], [u'a11', u'a.1']],
108
108
            [[u'b[1-2]'], [u'b1', u'b2']],
109
109
            [[u'A?'], [u'a1', u'a2']],
110
 
               
 
110
 
111
111
            [[u'd/*'], [u'd/d1', u'd/d2', u'd/e']],
112
112
            [[u'd\\*'], [u'd/d1', u'd/d2', u'd/e']],
113
113
            [[u'?\\*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
114
114
            [[u'*\\*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
115
115
            [[u'*/'], [u'c/', u'd/']],
116
116
            [[u'*\\'], [u'c/', u'd/']]])
117
 
        
 
117
 
118
118
    def test_tree_unicode(self):
119
119
        """Checks behaviour with non-ascii filenames"""
120
120
        self.build_tree([u'\u1234', u'\u1234\u1234', u'\u1235/', u'\u1235/\u1235'])
122
122
            # no wildcards
123
123
            [[u'\u1234'], [u'\u1234']],
124
124
            [[u'\u1235'], [u'\u1235']],
125
 
         
 
125
 
126
126
            [[u'\u1235/'], [u'\u1235/']],
127
127
            [[u'\u1235/\u1235'], [u'\u1235/\u1235']],
128
 
            
 
128
 
129
129
            # wildcards
130
130
            [[u'?'], [u'\u1234', u'\u1235']],
131
131
            [[u'*'], [u'\u1234', u'\u1234\u1234', u'\u1235']],
132
132
            [[u'\u1234*'], [u'\u1234', u'\u1234\u1234']],
133
 
            
 
133
 
134
134
            [[u'\u1235/?'], [u'\u1235/\u1235']],
135
135
            [[u'\u1235/*'], [u'\u1235/\u1235']],
136
136
            [[u'\u1235\\?'], [u'\u1235/\u1235']],
185
185
        first = win32utils.get_appdata_location()
186
186
        self._captureVar("APPDATA", None)
187
187
        self.assertPathsEqual(first, win32utils.get_appdata_location())
188
 
 
 
188
 
189
189
    def test_appdata_matches_environment(self):
190
190
        # Typically the APPDATA environment variable will match
191
191
        # get_appdata_location