fix prop_relPathDirToFileAbs_basics fail on windows
authorJoey Hess <joeyh@joeyh.name>
Mon, 18 Jan 2021 17:19:17 +0000 (13:19 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 18 Jan 2021 17:26:10 +0000 (13:26 -0400)
It was just slapping on a path separator to the front of the path to
make it absolute, but on windows, a path like "//foo/bar" actually
has a network "drive" of "//foo" and so that broke the test case.

Since "a:foo" is a somehow relative path on windows
(who knows how), drop any drive from the input. But dropDrive also drops
any leading path separator, making the input path relative. So now
it should be safe to slapp on a leading path separator.

Utility/Path/Tests.hs
doc/bugs/W__58__prop__95__relPathDirToFileAbs__95__basics_started_to_fail.mdwn

index 2d9c6152aa746a042c7ec0f54e8dddac46c29abe..c09151e4cd707429ed5d00fd661a43957fa4980c 100644 (file)
@@ -42,7 +42,10 @@ prop_relPathDirToFileAbs_basics pt = and
        , relPathDirToFileAbs p p == ""
        ]
   where
-       p = pathSeparator `B.cons` toRawFilePath (fromTestableFilePath pt)
+       -- Make the input an absolute path, since relPathDirToFileAbs
+       -- needs absolute paths.
+       p = pathSeparator `B.cons` dropDrive
+               (toRawFilePath (fromTestableFilePath pt))
 
 prop_relPathDirToFileAbs_regressionTest :: Bool
 prop_relPathDirToFileAbs_regressionTest = same_dir_shortcurcuits_at_difference
index 6c7b92b284f3d0aaa49864861f2cb0db0192e9aa..8f400439dfefdb8f1eff69b3fd6c9a2307747d91 100644 (file)
@@ -15,3 +15,5 @@ full list of recent runs with logs etc: [datalad/git-annex github actions](https
 
 [[!meta author=yoh]]
 [[!tag projects/datalad]]
+
+> [[fixed|done]] --[[Joey]]