Commit dfd54ce1 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a test for copyFile

parent 32b0f9d9
...@@ -54,6 +54,7 @@ test('misc001', extra_run_opts('misc001.hs misc001.out'), \ ...@@ -54,6 +54,7 @@ test('misc001', extra_run_opts('misc001.hs misc001.out'), \
compile_and_run, ['']) compile_and_run, [''])
clean(['misc001.out']) clean(['misc001.out'])
test('copyFile001', normal, compile_and_run, [''])
test('openFile001', normal, compile_and_run, ['']) test('openFile001', normal, compile_and_run, [''])
test('openFile002', exit_code(1), compile_and_run, ['']) test('openFile002', exit_code(1), compile_and_run, [''])
test('openFile003', normal, compile_and_run, ['']) test('openFile003', normal, compile_and_run, [''])
......
This is the data
\ No newline at end of file
module Main (main) where
import Control.Exception
import Data.List
import System.Directory
import System.IO
main :: IO ()
main = do try $ removeFile to
cs_before <- getDirectoryContents "copyFile"
putStrLn "Before:"
print $ sort cs_before
copyFile from to
cs_before <- getDirectoryContents "copyFile"
putStrLn "After:"
print $ sort cs_before
readFile to >>= print
from, to :: FilePath
from = "copyFile/source"
to = "copyFile/target"
Before:
[".","..","source"]
After:
[".","..","source","target"]
"This is the data"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment