266
266
self.assertEqual(expected_dirblocks[1:],
267
267
[[line[0:3] for line in block] for block in result])
269
def assertPathCompare(self, path_less, path_greater):
270
"""check that path_less and path_greater compare correctly."""
271
self.assertEqual(0, osutils.compare_paths_prefix_order(
272
path_less, path_less))
273
self.assertEqual(0, osutils.compare_paths_prefix_order(
274
path_greater, path_greater))
275
self.assertEqual(-1, osutils.compare_paths_prefix_order(
276
path_less, path_greater))
277
self.assertEqual(1, osutils.compare_paths_prefix_order(
278
path_greater, path_less))
280
def test_compare_paths_prefix_order(self):
281
# root before all else
282
self.assertPathCompare("/", "/a")
284
self.assertPathCompare("/a", "/b")
285
self.assertPathCompare("/b", "/z")
286
# high dirs before lower.
287
self.assertPathCompare("/z", "/a/a")
288
# lexical betwen dirs of the same height
289
self.assertPathCompare("/a/z", "/z/z")
290
self.assertPathCompare("/a/c/z", "/a/d/e")
292
# this should also be consistent for no leading / paths
293
# root before all else
294
self.assertPathCompare("", "a")
296
self.assertPathCompare("a", "b")
297
self.assertPathCompare("b", "z")
298
# high dirs before lower.
299
self.assertPathCompare("z", "a/a")
300
# lexical betwen dirs of the same height
301
self.assertPathCompare("a/z", "z/z")
302
self.assertPathCompare("a/c/z", "a/d/e")