Rev 4792: Use the right case sensitivity feature (cicp, not just ci). in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b3-glob-updates

John Arbash Meinel john at arbash-meinel.com
Sun Nov 8 00:27:26 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b3-glob-updates

------------------------------------------------------------
revno: 4792
revision-id: john at arbash-meinel.com-20091108002718-owomi0efq10hg8r7
parent: john at arbash-meinel.com-20091108001935-qix40x4c4hyqx3e5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b3-glob-updates
timestamp: Sat 2009-11-07 18:27:18 -0600
message:
  Use the right case sensitivity feature (cicp, not just ci).
  
  Convert the backslash tests to use another Feature.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_win32utils.py'
--- a/bzrlib/tests/test_win32utils.py	2009-11-08 00:19:35 +0000
+++ b/bzrlib/tests/test_win32utils.py	2009-11-08 00:27:18 +0000
@@ -32,6 +32,21 @@
 from bzrlib.win32utils import glob_expand, get_app_path
 
 
+class _BackslashDirSeparatorFeature(tests.Feature):
+
+    def _probe(self):
+        try:
+            os.lstat(os.getcwd() + '\\')
+        except OSError:
+            return False
+        else:
+            return True
+
+    def feature_name(self):
+        return "Filesystem treats '\\' as a directory separator."
+
+BackslashDirSeparatorFeature = _BackslashDirSeparatorFeature()
+
 
 class _RequiredModuleFeature(Feature):
 
@@ -106,12 +121,8 @@
             ])
 
     def test_backslash_globbing(self):
+        self.requireFeature(BackslashDirSeparatorFeature)
         self.build_ascii_tree()
-        try:
-            os.lstat('d\\d2')
-        except OSError:
-            raise tests.TestNotApplicable("filesystem doesn't treat"
-                " \\ as a directory separator")
         self._run_testset([
             [[u'd\\'], [u'd/']],
             [[u'd\\*'], [u'd/d1', u'd/d2', u'd/e']],
@@ -121,7 +132,7 @@
             ])
 
     def test_case_insensitive_globbing(self):
-        self.requireFeature(tests.CaseInsensitiveFilesystemFeature)
+        self.requireFeature(tests.CaseInsCasePresFilenameFeature)
         self.build_ascii_tree()
         self._run_testset([
             [[u'A'], [u'A']],
@@ -153,16 +164,12 @@
             ])
 
     def test_unicode_backslashes(self):
+        self.requireFeature(BackslashDirSeparatorFeature)
         self.build_unicode_tree()
-        try:
-            os.lstat('\u1235\\\u1235')
-        except OSError:
-            raise tests.TestNotApplicable("filesystem doesn't treat"
-                " \\ as a directory separator")
         self._run_testset([
             # no wildcards
-            [[u'\u1235\\'], [u'\u1235\\']],
-            [[u'\u1235\\\u1235'], [u'\u1235\\\u1235']],
+            [[u'\u1235\\'], [u'\u1235/']],
+            [[u'\u1235\\\u1235'], [u'\u1235/\u1235']],
             [[u'\u1235\\?'], [u'\u1235/\u1235']],
             [[u'\u1235\\*'], [u'\u1235/\u1235']],
             [[u'?\\'], [u'\u1235/']],
@@ -369,3 +376,13 @@
         # Expands the glob, but nothing matches
         self.assertCommandLine([u'a/*.c'], 'a\\*.c')
         self.assertCommandLine([u'a/foo.c'], 'a\\foo.c')
+
+    def test_case_insensitive_globs(self):
+        self.requireFeature(tests.CaseInsCasePresFilenameFeature)
+        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
+        self.assertCommandLine([u'A/b.c'], 'A/B*')
+
+    def test_backslashes(self):
+        self.requireFeature(BackslashDirSeparatorFeature)
+        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
+        self.assertCommandLine([u'a/b.c'], 'a\\b*')



More information about the bazaar-commits mailing list