summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IO/T4113.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/IO/T4113.hs')
-rw-r--r--testsuite/tests/lib/IO/T4113.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/T4113.hs b/testsuite/tests/lib/IO/T4113.hs
new file mode 100644
index 0000000000..3bc8096baa
--- /dev/null
+++ b/testsuite/tests/lib/IO/T4113.hs
@@ -0,0 +1,20 @@
+
+module Main (main) where
+
+import Control.Exception
+import Prelude hiding (catch)
+import System.Directory
+
+main :: IO ()
+main = do doit ""
+ doit "/no/such/file"
+
+doit :: FilePath -> IO ()
+doit fp = do fp' <- canonicalizePath fp
+ print (fp, mangle fp')
+ `catch` \e -> putStrLn ("Exception: " ++ show (e :: IOException))
+ where -- On Windows, "/no/such/file" -> "C:\\no\\such\\file", so
+ -- we remove the drive letter so as to get consistent output
+ mangle (_ : ':' : xs) = "drive:" ++ xs
+ mangle xs = xs
+